How to disable the "Back back" button after logging out in JSP?

Possible duplicate:
Restrict user access to the previous page after discharge

Develops a JSP application in netbeans 6.5.1. I need to disable the browser feedback button after logging in and also logging out. How is this possible?

0
source share
1 answer

Nothing can be done in JSP to directly influence this button back. Your JSP markup / code is evaluated on the server side as part of generating a response set by the client.

However, you can add the following JavaScript to the <head> section of the post-logoff page to achieve the rough desired effect:

 <script> history.forward(); </script> 

Source: http://answers.google.com/answers/threadview/id/574062.html

More generally, however, you can’t do anything to prevent a predefined user from finding a previously visited URL in his history and pointing to his browser after logging out. Instead, your session management code should be strong enough to know that it should not serve a request for an outdated URL if the user no longer has a valid session.

Or, if what you are really trying to do does not allow the browser to display the cached version of the page after logging in after the user logs out, you can do this (in most browsers) by setting the HTTP <header href = "http: //www.mnot .net / cache_docs / "rel =" nofollow "> Cache-Control with a no-cache value on all your pages after login.

+2
source

All Articles