my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes Inactivating Back button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Inactivating Back button" Watch "Inactivating Back button" New topic
Author

Inactivating Back button

Pandurangan Rakesh
Greenhorn

Joined: Jun 06, 2004
Posts: 24
Hi
I have a requirement where i need the Browser back button to be inactive when the user clicks(i.e) it should not respond..and the user should stay at the same window..since i have a back button in my screen....
Thanks in advance for replies
Regds
Rakesh
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

This is not possible.


GenRocket - Experts at Building Test Data
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

This is a recording...

You cannot and should not attempt to take over the user's computer. This includes the browser controls. You are given the browser window to work in so just keep your mitts off everything else.

If you don't want the browser controls confusing your user since you will have navigation in your own window, do what many other sites do and open a new window without the toolbars upon application launch.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Bear Bibeault:
If you don't want the browser controls confusing your user since you will have navigation in your own window, do what many other sites do and open a new window without the toolbars upon application launch.


This is another recording:

I can still right-click (windows and linux) and click Back from the context menu, so just stick with the first part of Bear's recording.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

I think there is merit to opening apps in a new window. Users, especially non-savvy ones, can get confused when the browser sports one set of controls, and the web app another. Opening the app in a non-toolbared window can alleviate some of that confusion.

But with regards to trying to prevent users from boofing up your application with back and refresh... yeah, you just have to buckle down and deal with it. Learn the coding techniques to deal with the issues introduced by back and refresh rather than trying to exert control over parts of the browser that you have no business futzing around with.
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by Gregg Bolinger:
This is not possible.


But if we see gmail then Back button doesn't seem to work at single click (double click works). :roll:
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by ankur rathi:


But if we see gmail then Back button doesn't seem to work at single click (double click works). :roll:


This is not GMail disabling the Back Button. This is GMail handling the back button, which is what we are trying to tell you to do.
 
jQuery in Action, 2nd edition
 
subject: Inactivating Back button
 
Similar Threads
How to call a javascript function on back button press of the brower window
Avoiding form resubmission
storing a whole page in a session
Sessions in Servlets
Log Out Problem