开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜