segalsegal
01-21-2009, 06:07 PM
I need to get document.referrer specified in order to have visits from our site recognized on another site. The problem is that our links are in a Java applet that pops up new browser windows. As a result, the destination site gets blank document.referrer information.
With Internet Explorer the workaround is simple because one can use a re-direct page that gets the destination URL specified in the query string and triggered by onload it extracts the destination URL and uses click() to go to it, thus setting the re-direct page as the referrer.
With Firefox this doesn't work, apparently because click() is disabled for security reasons.
Is there some way to get document.referrer information set? The best I've been able to do so far is have code that works as desired for Internet Explorer and refers to a different page for Firefox users, where the user needs to click a browser button explicitly to get to the destination site.
Is there some way to get this working without the user having to click a button?
The code that works for Internet Explorer and refers to another page for Firefox is:
<html>
<head>
<SCRIPT>
function clickTo()
{
document.links[0].href=document.location.search.substring(1);
document.links[0].click();
}
</SCRIPT>
</head>
<body onload="clickTo();">
<script>
if (navigator.appName.indexOf("Microsoft") < 0) location.replace("button.html" + document.location.search);
</script>
<form>
<a href="something.html"><input type=hidden onclick="clickTo();"></a>
</form>
</body>
</html>
With Internet Explorer the workaround is simple because one can use a re-direct page that gets the destination URL specified in the query string and triggered by onload it extracts the destination URL and uses click() to go to it, thus setting the re-direct page as the referrer.
With Firefox this doesn't work, apparently because click() is disabled for security reasons.
Is there some way to get document.referrer information set? The best I've been able to do so far is have code that works as desired for Internet Explorer and refers to a different page for Firefox users, where the user needs to click a browser button explicitly to get to the destination site.
Is there some way to get this working without the user having to click a button?
The code that works for Internet Explorer and refers to another page for Firefox is:
<html>
<head>
<SCRIPT>
function clickTo()
{
document.links[0].href=document.location.search.substring(1);
document.links[0].click();
}
</SCRIPT>
</head>
<body onload="clickTo();">
<script>
if (navigator.appName.indexOf("Microsoft") < 0) location.replace("button.html" + document.location.search);
</script>
<form>
<a href="something.html"><input type=hidden onclick="clickTo();"></a>
</form>
</body>
</html>