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

ie & referer header

P: n/a
hi,

when I load a new page with location.href, ie doesn't set the http
referer header while firefox&mozilla does...
I tried the click() method on a hidden link, this times it works on ie,
but firefox says that click is not a function
[...
<a id="ref" href.......>...</a>
....
document.getElementById("ref").click();
....]
Is there any method which I can set this header manualy or make ie set
it properly? Or any other idea?

Thanks
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Aziz wrote:
hi,

when I load a new page with location.href, ie doesn't set the http
referer header while firefox&mozilla does...
I tried the click() method on a hidden link, this times it works on ie,
but firefox says that click is not a function
[...
<a id="ref" href.......>...</a>
...
document.getElementById("ref").click();
...]
Is there any method which I can set this header manualy or make ie set
it properly? Or any other idea?

Thanks


var targetLink = document.getElementById("ref");
if(targetLink.click) // check function exists
{
targetLink.click();
}
else
{
// if no, replace location
self.location = targetLink.getAttribute("href");
}

While this does what you ask and illustrates a standard way to check for
a function before executing it, I'm not sure I'd recommend the approach.

If you need the referrer for some scripting reason in the target page,
why not include the referring URL as a parameter in the web address?

self.location = 'newpage.htm?referrer=' + self.location.href;

and, in the target page:

var referrer = self.location.search.substring(10);
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.