wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Browser Back Button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Browser Back Button " Watch "Browser Back Button " New topic

Browser Back Button


Joined: Nov 12, 2001
Posts: 18
Can i disable the back button of browser through javascript
James Hobson
Ranch Hand

Joined: Aug 28, 2001
Posts: 140
You can try -- but it is never going to be reliable -- different implementations of javascript, people disable javascript etc.
The best thing to do, is assign a transaction number to each page view (eith stick it onto the URL with ?transID=xxx or put it in a hidden field (just like you do with re-written URLs -- then let the server ignor requests that do not come from the correct page.
That way people can go back, but at least the server will know.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Like James said, there isn't really any complete and safe way to implement it, but I've seen it it done with moderate success using JSPs and Servlets, implementing a Model-View-Controller (MVC) pattern with a global controller and allowing the controller to dictate the page displayed. (with the additional functionality to prevent the client from caching pages)
If you can find a solution that doesn't require disabling the back button, you'll be a lot happier.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements.
I agree. Here's the link: http://aspose.com/file-tools
subject: Browser Back Button
Similar Threads
Retain the combo box value when the page is revisited
how to diable browser back button
Timing out the Session on Clicking The Browser Back Button
Log Out Problem
Disable Back button