deek22
asked on
Document.referrer script working in Firefox but not IE
I'm trying to create a simple script to verify the referrer URL, then if the referrer URL is what I specify display the content. So far this script works fine in Firefox, but does not seem to work in IE.
(linkaccess.html)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>test</title>
<script>
if (document.referrer != "http://www.domain.com/linksource.html"){
alert ("cannot find link")
location.href = "protect.html";
}
else {alert ("found it hurray")}
</script>
</head>
<body>
test
</body>
</html>
(linksource.html)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>test</title>
</head>
<body>
<a href="linkaccess.html">tes t</a>
</body>
</html>
(protect.html)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>test</title>
</head>
<body>
You don't belong here
</body>
</html>
(linkaccess.html)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>test</title>
<script>
if (document.referrer != "http://www.domain.com/linksource.html"){
alert ("cannot find link")
location.href = "protect.html";
}
else {alert ("found it hurray")}
</script>
</head>
<body>
test
</body>
</html>
(linksource.html)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>test</title>
</head>
<body>
<a href="linkaccess.html">tes
</body>
</html>
(protect.html)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>test</title>
</head>
<body>
You don't belong here
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why the grading B?
ASKER
Well, I guess a Grade A would have been a more comprehensive answer with maybe some links to help understand the response.redirect concept. Please forgive me if I sound a bit picky.
I greatly appreciate your help,
I greatly appreciate your help,
No problem, it is your question and your opinion.
But be aware that my opinion also changes depending on feedback I get ;-)
But be aware that my opinion also changes depending on feedback I get ;-)
ASKER
http://blogs.msdn.com/lisawoll/archive/2005/06/24/432429.aspx
Thx