...

View Full Version : Remember each pages referring page.



Gary Williams
10-06-2003, 09:33 AM
Hi All,

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.

If any one can come up with a javascript/javascripted process to solve this one, they would have a good site access security product that people would pay for.

Any idea's?

Regards

Gary

brothercake
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.

brothercake
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.

Gary Williams
10-06-2003, 10:01 AM
Hi Brothercake,

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?

Regards

Gary

glenngv
10-06-2003, 10:23 AM
http://www.codingforums.com/showthread.php?s=&threadid=27245

Gary Williams
10-06-2003, 11:07 AM
Hi Glenn,

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!).

Cheers

Gary

glenngv
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.

brothercake
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum