This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

logout when click on the back button on browser

 
Narasimha Reddy
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How to invalidate the session when the user clicks back button on the
browser.I know HttpSession.invalidate() method is there.But how to invoke that method when the user clicks back button of the browser.

Thanks for ur respose in advance.

Thanks&Regards,
Narasimha Reddy
SCJP1.4
 
Sravan Kumar
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want to invalidate a session on the click of back button?

I hope you have a button or link in your web-app that the user has to press when he wants to logout. Track this action to the server side and call invalidate() explicitly. You would not have to worry about the back button then.
 
Narasimha Reddy
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sravan,
thanks for ur response.
It is possible to expire the session when clicking on back button of browser.If posible please give the instructions how to handle that one.

Thanks&Regards,
Narasimha Reddy
SCJP1.4
 
Gaurav Chhabras
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when the user clicks the BACK button then take that to other page and check whether BACK button is pressed or not.
If yes then call the invalidate() function and you will win the arena.

Best of Luck.
Gaurav
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic