Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to prevent going back to the previous page by hitting the Back button ?

843842Oct 22 2008 — edited Oct 23 2008
In the html code I generate from my servlet, I have the following :
<Html>
<Head>
<Title>Cox Part Time Benefit App Login Page</Title>

<Meta http-equiv="Pragma" content="no-cache">
<!-- Pragma content set to no-cache tells the browser not to cache the page. This may or may not work in IE -->

<Meta http-equiv="expires" content="0">
<!-- Setting the page to expire at 0 means the page is immediately expired. Any vales less then one will
set the page to expire some time in past and not be cached. This may not work with Navigator -->

<Meta http-equiv="Cache-Control" content="no-cache">
<!-- This directive indicates cached information should not be used and instead requests should be forwarded
to the origin server. This directive has the same semantics as the PRAGMA:NO-CACHE -->
</Head>
......

I hope it can prevent user from going back to the previous page by hitting the Back button on the browser, but it doesn't, what's the right way to do it ?

Frank
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 20 2008
Added on Oct 22 2008
10 comments
913 views