How to save URL request parameters when linking?

This is the login.html code:

<ul> <li class="introduction"> <a href="introduction.html"> <span class="icon"></span> Introduction </a> </li> <li class="login active"> <a href="#"> <span class="login"></span> Login </a> </li> </ul> 

An external link will first lead to the current page (login) with some request parameters that I want to save . If the user clicks the first introduction link, the introduction file will be downloaded. However, all request parameters on the previous page (login) are lost.

In any case, can I load this page while retaining the request parameters? Either use HTML or Javascript.

Thank you very much.

+6
source share
2 answers

Part of the URL you're interested in is called search .

You can link to another page with the same parameters using

 <a onclick="window.location='someotherpage'+window.location.search;">Login</a> 
+11
source

Automatically add current parameters to any links that you consider worthy using the rel="" attribute in the <a> tags (using jQuery):

 <a href="introduction.html" rel="keep-params">Link</a> 
 // all <a> tags containing a certain rel="" $("a[rel~='keep-params']").click(function(e) { e.preventDefault(); var params = window.location.search, dest = $(this).attr('href') + params; // in my experience, a short timeout has helped overcome browser bugs window.setTimeout(function() { window.location.href = dest; }, 100); }); 
+3
source

All Articles