File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Expiring a page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Expiring a page" Watch "Expiring a page" New topic
Author

Expiring a page

Abraham Jacob
Greenhorn

Joined: Oct 16, 2001
Posts: 25
Hi All,
I am trying to expiry a page in the browser history/cache. Basically here is the problem
(post)
jspPage1 ---> jspPage2

When the user is on jspPage2 and presses the browsers back button I want the jspPage1 reloaded/refreshed from the server.
I tried using the META tag
<META http-equiv="Pragma" content="no-cache">
but somehow this does not seem to solve the problem... (I am using IE 5.5)
Thanx,
Abraham Jacob
Greenhorn

Joined: Oct 16, 2001
Posts: 25
Looks like I found the answer... (just in case anybody else needs it...)
Using JSP...
<%
response.setDateHeader ("Expires", 0);
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-store");
response.setDateHeader("max-age", 0);
response.setDateHeader("Expires", 0);
%>

Now I have another question.....
Is there any way to find out that the page has expired and that it should reload itself.
Right now in IE 5.5 it shows me that the page has expired and that I should physcically press the refresh/reload button...
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

Add this tag in the <head> and </head> tag of your HTML, it will refresh the page after every 10 seconds. But, page refreshing itself this frequently is not a good idea, unless you are refreshing some live match score or somthing...

- Manish
Abraham Jacob
Greenhorn

Joined: Oct 16, 2001
Posts: 25
Thanx for the reply manish
Is there a way to find out that when the user press the back button or the refresh button it is actually loading an expired page which can be trapped by JavaScript ?
 
 
subject: Expiring a page