By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,921 Members | 1,493 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,921 IT Pros & Developers. It's quick & easy.

window.location=... doesn't send referrer?

100+
P: 103
Hello

I have a script which records a click and then sends the user to the location. The idea is to keep nice links in the HTML but still do some javascript when the link is clicked.

I find that when using IE6 the page that is loaded doesn't register the referrer. in PHP - $_SERVER['HTTP_REFERER'] is null.

I'm using this simple code:

Expand|Select|Wrap|Line Numbers
  1. r = link.href;
  2. window.location = r;
  3.  
I want the referer to be sent - should I use an alternative method to load the page the user clicked on?

Thanks in advance!

Henry
Feb 1 '08 #1
Share this Question
Share on Google+
2 Replies


100+
P: 428
document.referrer is the empty string if the request did not come from a link.
Otherwise, you could program a billion calls to an ad server page and retire.
Feb 1 '08 #2

100+
P: 103
Hi

Thanks for the reply. This certainly makes sense.

I have been testing a bit more and it seems internet explorer behaviour differs from Firefox.

The click originates from a link but I cancel the default action - ie the new page loading - to give time for my AJAX script to run. Then I send the user onwards. The differences is milliseconds.

With Firefox, the original refererrer is retained while with IE6 the referer is blank.

Does anyone know any way to mimic the Firefox behaviour in IE6?
Feb 4 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.