Friendly Page Redirect - DHTML Lab - DHTML Diner | 2
Friendly Page Redirect
Reason for the Blues
The diagram below illustrates a possible sequence of pages loaded into your browser that will cause the Back Button Blues:
Assume you are on a site's start page (index.html). You click a regular HTML link to navigate to coolpage.html.
The author of coolpage.html has made the page cool only for IE users. A Navigator user, for example, will be redirected to a new page (sorry.html). The redirect is accomplished by checking for the use of IE, and executing the following statement if IE is not being used:
window.location = "sorry.html";
window.location.href = "sorry.html"; location = "sorry.html"; location.href = "sorry.html"; document.URL = "sorry.html";
We have used this syntax in many of our scripts here at DHTML Lab, most importanatly in the Fader and HierMenus scripts. In these scripts, the syntax is the correct one, but in the example above, it is not.
All of the above statements will load a new page as the next page in the browser's history. As we know, the Back and Forward buttons navigate through visited-page history. The above example creates a history stack (last-in-first-out) that looks like this:
If we are viewing sorry.html, the previous entry in the browser's history is coolpage.html. Clicking the Back button takes us to coolpage.html, which has the redirect statement and so we are brought back to sorry.html. This explains the perceived looping which, of course, is the correct browser behavior!
Produced by Peter Belesis andAll Rights Reserved. Legal Notices.
Created: Mar 21, 2000
Revised: Mar 21, 2000