File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Logout, Browser back button problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Logout, Browser back button problem" Watch "Logout, Browser back button problem" New topic

Logout, Browser back button problem

jay Rotti

Joined: Apr 05, 2001
Posts: 9
I have similar situation as above.
When user logoff
but after going to login.html if user clicks browser back button it display's the contnts of the page. How do I prevent it. Any help appreciated. I have a peice of code in a page when user clicks browser back button to know the session and prevent, but still doesn't work.
In netscape ir works I guess:
Data Missing
This document resulted from a POST operation and has expired from the cache. If you wish you can repost the form data to recreate the document by pressing the
reload button.

but IE it shows contents of the page.
Please any help appreciated.
Jay Rotti
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
PLease refer to this thread.
maha anna
jay Rotti

Joined: Apr 05, 2001
Posts: 9
Thanks maha anna
but let me re frame my problem.
All the cache preventing methods and session invalidation works absolutley fine in Netscape but it doesn't work in IE, do you think anything wrong in my prog?
Have a look(this a page which gets displayed even after session is invalid and when user hits browser back button)
I am cinfident that it si caching because when I refresh the same page it doesn't dipaly the contents"
<%@ page language="java" contentType="text/html" %>
response.addHeader("Pragma", "No-cache");
response.addHeader("Cache-Control", "no-cache");
response.addDateHeader("Expires", 0);
response.setDateHeader("max-age", 0);
if (session.getAttribute("fullname") == null)
out.println("Sorry You are not allowed to view the contents of the page");
<title>All Tickets</title>
<meta http-equiv="refresh" content="text/html; charset=iso-8859-1" >
<% out.println(rs.getString("name")); %>
Jay rotti
I agree. Here's the link:
subject: Logout, Browser back button problem
It's not a secret anymore!