Inside Technique : Leaving the past behind
In this article we present a simple script for the 4.0 and later browsers that causes all links on the page to replace the current page in the user's history. With this technique you can create a series of pages that are never added to the history. When the user hits the back button they are navigated immediately before the page sequence. I can see this technique being used in on-line games or in multi-page forms.
This technique works by including the script (provided on the next page) within your web-page. The script relies on event bubbling in Internet Explorer and event capturing in Netscape Navigator to capture all clicks then checks if the click is on a link. If the user clicks a link we manually navigate the user to the new page using the location object's replace method. The replace method replaces the history entry for the current page with the new page. This occurs for all links on the page.
You can apply this same technique to a single link on your page. Unlike our global solution, this technique
works the same in both browsers and does not require any special browser detection. You simply write your script
in the link's in-line onclick event handler:
Next we provide the code for our global technique and point out a few limitations with the script. To see how this technique works, you can continue to the next page using this link. After the next page loads, try using the back button. The back button will take you to the page prior to this one. (All other links on this page operate normally).
Page 1:Leaving the past behind
© 1997-2000 InsideDHTML.com, LLC. All rights reserved.