Click to See Complete Forum and Search --> : IE does not pass referer
raven80
10-16-2007, 12:52 AM
IE does not pass referer when I'm using meta tag or javascript to redirect a page but FF does.
Are there any way to make it pass referer ?? I need it to statistic and track pages where customer come from.
Thanks.
harumph
10-16-2007, 09:18 AM
Show us the script you're presently using to retrieve the referrer.
TJ111
10-16-2007, 09:26 AM
I had this same problem the other day, I had to pass them as get variables for now. I had the following
alert("<?=$_SERVER['HTTP_REFERER']?>");
That would alert properly in FF but not in IE. IE would just be an empty alert.
harumph
10-16-2007, 09:28 AM
What are you using: PHP, ASP, JSP, CFM?
TJ111
10-16-2007, 09:30 AM
I'm using PHP, don't know about OP.
harumph
10-16-2007, 10:04 AM
Guess you wouldn't want to put it into a variable in the address string for SEO reasons. Could session variables work?
TJ111
10-16-2007, 10:18 AM
I could use sessions variables, right now it's not a big issue so I'm not going to worry about it. I just thought it was odd.
harumph
10-16-2007, 10:43 AM
Yea. I have submitted a hidden form to snag it.
raven80
10-16-2007, 11:37 AM
Show us the script you're presently using to retrieve the referrer.
Redirect file:
<html>
<head>
<title>Just test ...</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<!-- do something -->
<script language="javascript">
window.location.href="http://www.mydomain.com/info.php";
</script>
</body>
</html>
Get referer:
<?php
echo 'Referer from ( PHP ): '.$_SERVER['HTTP_REFERER'].'<br>';
echo "<script language='javascript'>document.write('Referer from ( javascript ): ' + document.referrer);</script>";
?>
Firefox shows referer but IE shows none.
dragle
10-16-2007, 01:49 PM
If you don't mind IE proprietary code you could do something like this:
<html>
<head>
<title>Redirect w/Referrer in Internet Explorer</title>
<script type="text/javascript">
function redirect(url) {
var theLink = '';
if (document.getElementById) {
theLink = document.getElementById('redirect_link');
if (!theLink) {
theLink = document.createElement('a');
theLink.style.display = 'none';
theLink.id = 'redirect_link';
document.body.appendChild(theLink);
}
if (url) theLink.href = url;
}
if ((theLink) && (theLink.click)) theLink.click();
else location.href = url;
}
</script>
</head>
<body>
<p><a id='redirect_link'
href='http://www.mydomain.com/info.php'>Click Here to redirect</a></p>
<script type="text/javascript">
redirect('http://www.mydomain.com/info.php');
</script>
</body>
</html>
Don't know about meta refreshes, though.
HTH,
http://support.microsoft.com/?kbid=178066#top
raven80
10-17-2007, 12:09 AM
If you don't mind IE proprietary code you could do something like this:
<html>
<head>
<title>Redirect w/Referrer in Internet Explorer</title>
<script type="text/javascript">
function redirect(url) {
var theLink = '';
if (document.getElementById) {
theLink = document.getElementById('redirect_link');
if (!theLink) {
theLink = document.createElement('a');
theLink.style.display = 'none';
theLink.id = 'redirect_link';
document.body.appendChild(theLink);
}
if (url) theLink.href = url;
}
if ((theLink) && (theLink.click)) theLink.click();
else location.href = url;
}
</script>
</head>
<body>
<p><a id='redirect_link'
href='http://www.mydomain.com/info.php'>Click Here to redirect</a></p>
<script type="text/javascript">
redirect('http://www.mydomain.com/info.php');
</script>
</body>
</html>
Don't know about meta refreshes, though.
HTH,
Yeah, it works for me :D Thank a lot
Thank all for helping