Link to home
Start Free TrialLog in
Avatar of deek22
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">test</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>
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of deek22
deek22

ASKER

Thanks for the pointer :  I used this link to help protect my page:

http://blogs.msdn.com/lisawoll/archive/2005/06/24/432429.aspx


Thx
Why the grading B?
Avatar of deek22

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,


No problem, it is your question and your opinion.
But be aware that my opinion also changes depending on feedback I get ;-)