admin管理员组

文章数量:1022949

Say I have included document.referrer() in my website(www.abc) and I got redirected to my site from google.

Will the above mentioned code help me to get google?

Say I have included document.referrer() in my website(www.abc.) and I got redirected to my site from google..

Will the above mentioned code help me to get google.?

Share Improve this question edited May 5, 2011 at 6:51 kapa 78.8k21 gold badges165 silver badges178 bronze badges asked May 5, 2011 at 6:44 jagrtijagrti 551 gold badge1 silver badge2 bronze badges 2
  • 1 cant try bcoz i dont have any site. .:-( – jagrti Commented May 5, 2011 at 6:47
  • 1 try using jsfiddle, you can try out any script you need. Or you rcould even try it yourself on w3schools on there interactive tutorial w3schools./jsref/prop_doc_referrer.asp and w3schools./jsref/tryit.asp?filename=tryjsref_doc_referrer – Tom Gruner Commented May 5, 2011 at 7:01
Add a ment  | 

2 Answers 2

Reset to default 1

The search results in Google are not direct links. For example searching for abc the first result actual link is: http://www.google.co.uk/url?sa=t&source=web&cd=1&ved=0CC0QFjAA&url=http%3A%2F%2Fabc.go.%2F&ei=_0nCTeOMFYOVswbY7PyHAQ&usg=AFQjCNHN69w2aXwjgMlF4X6o9W3lKd4uZw

The redirection is then made server side so the code in abc.go. website might not get proper referrer.

javascript:alert(document.referrer);

When you will insert it at address bar, the previous location will appear, like the addresses appear on address bar, like http://php/manual/en/control-structures.break.php. You can use it to make plex JavaScript operations, like regular expressions. I will give very simple example

<script type="text/javascript">
if (document.referrer.search('google')==-1){
    alert('Not using Google');
} else {
    alert('Yes, from Google');
}
</script>

Say I have included document.referrer() in my website(www.abc) and I got redirected to my site from google.

Will the above mentioned code help me to get google?

Say I have included document.referrer() in my website(www.abc.) and I got redirected to my site from google..

Will the above mentioned code help me to get google.?

Share Improve this question edited May 5, 2011 at 6:51 kapa 78.8k21 gold badges165 silver badges178 bronze badges asked May 5, 2011 at 6:44 jagrtijagrti 551 gold badge1 silver badge2 bronze badges 2
  • 1 cant try bcoz i dont have any site. .:-( – jagrti Commented May 5, 2011 at 6:47
  • 1 try using jsfiddle, you can try out any script you need. Or you rcould even try it yourself on w3schools on there interactive tutorial w3schools./jsref/prop_doc_referrer.asp and w3schools./jsref/tryit.asp?filename=tryjsref_doc_referrer – Tom Gruner Commented May 5, 2011 at 7:01
Add a ment  | 

2 Answers 2

Reset to default 1

The search results in Google are not direct links. For example searching for abc the first result actual link is: http://www.google.co.uk/url?sa=t&source=web&cd=1&ved=0CC0QFjAA&url=http%3A%2F%2Fabc.go.%2F&ei=_0nCTeOMFYOVswbY7PyHAQ&usg=AFQjCNHN69w2aXwjgMlF4X6o9W3lKd4uZw

The redirection is then made server side so the code in abc.go. website might not get proper referrer.

javascript:alert(document.referrer);

When you will insert it at address bar, the previous location will appear, like the addresses appear on address bar, like http://php/manual/en/control-structures.break.php. You can use it to make plex JavaScript operations, like regular expressions. I will give very simple example

<script type="text/javascript">
if (document.referrer.search('google')==-1){
    alert('Not using Google');
} else {
    alert('Yes, from Google');
}
</script>

本文标签: Javascript documentreferrerStack Overflow