aspose file tools*
The moose likes Servlets and the fly likes Disabling forward button in browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Disabling forward button in browser" Watch "Disabling forward button in browser" New topic
Author

Disabling forward button in browser

Gopal Shah
Ranch Hand

Joined: May 17, 2003
Posts: 65
Hi,

I am displaying a html page using servlet. I want to disable the forward button in the browser.

I think it is something to do with HTTP header. But didn't feel comfortable going thru ietf and understanding the protocol.

Thanks & Regards,
Gopal
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60055
    
  65

There is nothing you can set in the header to disable the browser buttons.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Gopal Shah
Ranch Hand

Joined: May 17, 2003
Posts: 65
Will invalidating the session work ?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29245
    
139

Gopal,
You can't disable the browsers forward button. You can stop further requests from being processed on the server side. That can be done through session invalidation or tokens.

If you are taking this approach make sure to set the http headers so the page can't be cached. Otherwise, someone could use the forward button and see a cached page.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12680
    
    5
You can have JavaScript (on the browser side) open a new browser window that does not have back and forward buttons, and fill it from your servlet. There is no way to do this with HTTP headers, it has to be code on the client side.

You see this all the time on commercial sites.

Bill


Java Resources at www.wbrogden.com
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Disabling forward button in browser
 
Similar Threads
How to control Back&Forward buttons.
Disable Back button
selenium rc - go forward
Help with Web project...
How to clear a request attribute/entry