Getting the Previous Page with HTTP_REFERER
Written by Eric Smith, Northstar Computer Systems LLC
A number of people have reminded me that there is a bug in IE that causes the HTTP_REFERER variable not to fill properly in certain cases. This means that if you post results from one page to another, the HTTP_REFERER will not always point to the correct location.
If you're looking to do a back button, you can use a little Javascript to manipulate the user's browser history. Here's a link that will cause the browser to go back two entries in the history:
<a href="javascript:history.go(-2)">Return to the first page</a>
This Javascript works fine in IE 5.0 – your results may vary in other browsers.
If you do need the page name as part of the form input data, just add a hidden input field with the value of Request.ServerVariables("SCRIPT_NAME"). That way you guarantee that the filename is sent along with the rest of the form data.
Keywords: [
Uncategorized ASP Tips
]
Publication Date: 7/13/2000
|