September 23, 1999 - Forgetting the Past | WebReference

September 23, 1999 - Forgetting the Past

Yehuda Shiran September 23, 1999
Forgetting the Past
Tips: September 1999

Yehuda Shiran, Ph.D.
Doc JavaScript

The location object's replace() method overwrites the current history entry with the specified URL. It removes the current history entry before the next URL is loaded. Removing the item from the history list also prevents users from seeing the page again by clicking on the Back button later.

This technique is very useful for online games and multi-page forms, where you want prevent the user from returning to the previous page. Furthermore, the location.replace() method is supported by all browsers except Navigator 2.0x. The following example shows how to use this method in a link:

<A HREF="javascript:location.replace('nextpage.html')">Advance</A>