Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

disable the back button

 
sanchit agarwal
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friends this is my first question on java ranch. I am working on web based application (database on cloud) and i want to disable the back button when user click on log out button, means that if user clicks on log out button then he will not be able to go to the previous page. I am doing invalidate the session but when i click the back button then it take me on previous page,although i am not able to do anything on it but still its matter that why it take me on previous page. I just want to stay on current page can anyone help me out...
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this topic discussed many times here. please read this
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
welcome to javaranch :)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64848
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't reliable do this, and it's a good thing too. It's not your browser; don't mess with it. Read InterfaceDesignersRule1

What problem are you actually trying to solve? Disabling the back button won't solve it.
 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This link may help you http://www.javaworld.com/javaworld/jw-09-2004/jw-0927-logout.html?page=1 and i added a time column which will store time in milliseconds when user logged in. After logout try to compare the time. i am giving a sample code in jsp sorry it is not in JSTL it is a basic example.
include this in jsp and get it in servlet update the value in db. user loged out you are redirected to jsp page. now when he/she clicks back button, compare old time with this one.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mallikarjun dontamsetti wrote:This link may help you http://www.javaworld.com/javaworld/jw-09-2004/jw-0927-logout.html?page=1 and i added a time column which will store time in milliseconds when user logged in. After logout try to compare the time. i am giving a sample code in jsp sorry it is not in JSTL it is a basic example.
include this in jsp and get it in servlet update the value in db. user loged out you are redirected to jsp page. now when he/she clicks back button, compare old time with this one.


this currentTimeMillis techniques for only the page which we go for was displayed using POST method. this techniques can be avoided if you use PRG technique[search JSP FAQ].

and if back button rendering page was display by GET , then 1.clear browser cache 2. validate user name on the page.
 
Manjunath Gajula
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Agarwal,
Why have you decided to disable BACK button? Are you facing any problem when user clicks on back button?
 
caushik conjetty sekhar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Manjunath Gajula wrote:Hi Agarwal,
Why have you decided to disable BACK button? Are you facing any problem when user clicks on back button?


Please give a solution..
 
Junilu Lacar
Bartender
Posts: 7466
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
caushik conjetty sekhar wrote:Please give a solution..

There is none that directly addresses the Back button question. The answer, as stated many times before, is to not try to disable the user's back button. The problem you want to actually solve is probably figuring out a way for your application to gracefully and correctly handle resubmissions of stale requests.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic