This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSP and the fly likes how to prevent user browse back to previous page after sign out! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to prevent user browse back to previous page after sign out!" Watch "how to prevent user browse back to previous page after sign out!" New topic
Author

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

wei liu
Ranch Hand

Joined: Nov 19, 2008
Posts: 35

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


SCJP 1.6 in 2010
SCWCD5 in 2011
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to prevent user browse back to previous page after sign out!