On click save link to variable and redirect to differnet link
I have a webpage with many links on it. I want to add a script to work through out the whole page that when any link on the page is clicked on the page it will save that link to a variable and then redirect to to www.redirectlink.com
SO far I have
$('a'开发者_Python百科).click(function(){
location.href='http://www.redirectlink.com';
return false;
});
Is this right and how would I make it save the original url in a variable that I can use later on on the www.redirectlink.com page
$('a').click(function(e){
e.preventDefault();
document.location.href='http://www.redirectlink.com?ref='+this.href;
return false;
});
You can now use $_REQUEST['ref']
in the redirectlink to check the refferer.
精彩评论