This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello, Looking through this group and others, I see that disabling the browser back button is not 100% possible. But is it possible for a servlet to somehow 'detect' that the back button was pressed? Are there any tricks to do this? Just for background: the application I am working on will fail sometimes when using the back button because information is taken both from a link on the page and the session. When using the back button, the session data will become outdated and may not be compatible with the link parameters of the current page. Any suggestions would be appreciated. TIA! --Kkoszegi
you can use: history.go(1); in the header of each and every servlet page - include it in a js file if you want... that way, when a user presses the back button, on trying to load the provious page, the browser goes forward one ie: stays on the current page. In IE this works sweet, and there is no page flicker really -but NutScrape has a bit of a flicker - but both work. This is the only way I have found of disabling the back. Another way, is to code your app so that it handles the situation where someone has pressed the back button. always code for the worst case scenario -if a user can break it, they will - and complain they will also!! cheers
Joined: Aug 20, 2001
Hello, Thanks for your reply, Brian. Things have changed a little and disabling the back button is not a possibility. Like I said before, I am interested in finding out how the servlet could detect that the back button was pressed. Does anyone have an idea as to how I could do that? Thanks, --KKoszegi