Location.replace() (Method)

Load a new page and replace the history entry.

Availability:

DOM level - 1
JavaScript - 1.1
JScript - 3.0
Internet Explorer - 4.0
Netscape - 3.0
Opera - 3.0
JavaScript syntax:-myLocation.replace(aURL)
Argument list:aURLA URL to load into the layer, window or frame this location belongs to

This method is a useful way of loading new pages if you want to make sure the history list does not get filled up with unwanted pages. This makes the back button more useful to the user.

While the replace goes on, the existing page will continue to be displayed. This also applies if the replace is called during the <HEAD> portion of a page. The new URL is requested but the browser will continue loading and building the previous page until the web server responds and delivers the new replacement page. Termination of the old page therefore happens when the new page begins to arrive and not when it is first requested.