• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disabling 'Back' button of the browser

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • 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
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
 
Danny Mui
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • 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...).
 
ali farid
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Very slick!
 
milan doshi
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic