Entry
How can I get a browser to not put the page the user is on into the History?
Jun 2nd, 2000 18:31
Mike Hall, Jon Pettit,
That depends on what you mean exactly. Whatever page is being displayed
in the browser will always be the last entry in the history list. What
you can do, however, is make a link on the current page load a new page
that will replace the current one in the history list.
For example, you load page1.html which has a link to page2.html. The
user clicks on the link and now the history looks like
page2.html <- current page
page1.html
Now on page2.html you have:
<a href="page3.html" onclick="window.location.replace(this.href);
return false;">Page 3</a>
The user clicks on that and page3.html loads, but it replaces page2.html
in the history list:
page3.html <- current page, has replaced page2.html
page1.html
If the user now hits the back button, page1.html will load instead of
page2.html.