This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes how to diable browser back button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to diable browser back button" Watch "how to diable browser back button" New topic

how to diable browser back button

Shivanath Yerra

Joined: Jul 16, 2001
Posts: 8
how to disable the browser back button?
Jeff Sunder
Ranch Hand

Joined: Jun 26, 2001
Posts: 47
I have done a lot of research on this and the basic answer is that you cannot. There are many tricks that you can try, but none of them actually disable the back button.
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347

Jeff is correct however one of the tricks he mentions is this:
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>

Visit my download page
I agree. Here's the link:
subject: how to diable browser back button