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);