There is a button
<button class="btn js-goto-link" role="button" href="" data-goto="https://site.ru" data-goto-referer="true">Вход</button> and js code handler:
activate(); function activate() { $(document).on("click", ".js-goto-link", gotoLinkHandler); } function gotoLinkHandler(e) { e.preventDefault(); var href = $(this).data('goto'); var referer = localStorage.getItem('referal'); window.location.href = href + (referer ? "?referer=" + referer : ""); } you need to remake the button on the link a , so that the href attribute href value of the data-goto attribute, but also the referer parameters are added to the get request, which are pulled in the js code from localStorage .
Tell me how to do it right?
And anyway, is there a difference in the transition from window.location.href to the href link attribute?
PS Can this be done with php ?