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

how to prevent user browse back to previous page after sign out!

 
wei liu
Ranch Hand
Posts: 35
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone,

How to prevent user from visting back using browser "go back button" after signout, I have tried



it did show an page expired page when user trying to go back, however, even when user stay logged in, user will get the "page expire" when using the go back button.

Can anyone give me some clue how to prevent user from goint back to previous page (ideally redirect to login page) after sign out, while user can freely go back to previous page while logined in.


Thanks
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, make sure your dynamic pages have no cache headers or your browser will return an in-memory copy of the previous page when the back button is clicked.
See:
http://faq.javaranch.com/java/NoCacheHeaders

Then, to insure that they don't back click themselves all the way to the original login, use the post-redirect-get pattern to make sure that the first page of your app is returned from a get request, not the actual login post.
See:
http://faq.javaranch.com/java/PostRedirectGet

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic