View Full Version : Remember each pages referring page.
10-06-2003, 09:33 AM
I need a script (triggered by body onLoad) that will store and display in an alert box, the url of the previous page to the one displayed. That is, I need to know the url of the page that called the one currently on the screen.
I know that document.referrer is not reliable across all versions of IE and that you can't get at the 'History' function anymore.
10-06-2003, 09:50 AM
It's nothing to do with IE per se, it's just that browsers and proxy servers can be configured not to send referer information with requests. There isn't a workaround - if referer information isn't there there's no process that can get it.
What do you really want? If you're looking to validate a mailform or something like that, PHP or ASP session validation is probably your best bet.
10-06-2003, 09:53 AM
btw - I deleted your other thread which was almost the same as this. Please don't start multiple threads on the same subject.
10-06-2003, 10:01 AM
I need to make sure that the visitor to the site enters from the front page and cannot view a subsequent page by having bookmarked it on a previous visit and 'jump' straight in. As 'referrer' and 'history' are not suitable, how can I store the current pages URL so that the next page can test if the referring page is acceptable?
10-06-2003, 10:23 AM
10-06-2003, 11:07 AM
I started with request.servervariables("HTTP_REFERER") but the problem is that it is not always available, or am I doing something wrong (like trying to becone a programmer!).
10-06-2003, 11:31 AM
the reason for that is what brothercake mentioned in his first post. Use session validation instead of checking referrer.
10-06-2003, 12:55 PM
So you have to establish a session on your front page. On subsequent pages you check for that session variable, and if it isn't there do a redirect or whatever.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.