Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Disabling 'Back' button of the browser

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends
I have a situation in which I do not want user to use
back button of browser.
how it is possible?
Please help.
Jaisinh
 
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can open up a popup window that doesn't have the toolbar. They can still use the right click, but if you opened a new window, then they don't have anything in thier history so back wouldn't do anything anyways.
Bill
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bill,
This is ok when there is just a sing screen.
My application is moving through pages and collecting information from user on different questions.
In this situation how we can disable Back button.
Jaisinh
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If that is the case, I don't think you can. Back button has to do with the users history, so you may be able to play with thier history, but I don't think you can disable it. You can hide it as I said with a pop-up, and then capture the persons right click so they can't right-click and go back, but if they have javascript turned off you are out of luck. And whenever I go to a site and they disable my right click, I always turn off my javascript to find out why.
Bill
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe you could do this with an applet? You could embed a JEditorPane in a JApplet and use it to display your HTML pages. Then you could control what is being displayed using Java. Since all of this would be in a single HTML doc with the Applet embedded in it, the back button would not be relevant?
What are your thoughts on this, Bill?
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good idea Bodie, development time would increase, but you are right the back button would only take you to the page right before the form, so that would work. Not sure if it would be worth it considering the extra time to develop, but doable.
Bill
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're using a server page/servlet technology, you can stuff a token in the session to validate with a page (i.e. page 1 expects token 234223 and gets assigned a diff one after page 2 is loaded...).
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Maybe this link will help
http://www.webreference.com/js/tips/990923.html
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Very slick!
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If we are using Servlets , we can do it using the headers !
The whole idea is that when a page is downloaded it is stored in the cache. hence if we give a command while sending a page that it should not be stored in the cache that WILL WORK. That means when the Browsers back button is clicked it will not get anything for the simple reason that the page is not stored in the temporary memory.
Hence HttpResponse Header is to be used .
Regards,
Milan Doshi
 
Sunglasses. AKA Coolness prosthetic. This tiny ad doesn't need shades:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic