aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Question on NOT Cache.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Question on NOT Cache...." Watch "Question on NOT Cache...." New topic
Author

Question on NOT Cache....

Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
Hi frinds,
I want to request the IE 6.0 browser to NOT cache my web application page.
This is a network management application and it is important tha the user be
presented with the MOST RECENT status of the device being managed.
Now I did some search on the net and added the following meta tags to my
html page.
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT">
even I tried this:

but it doesn't work could you please help me what should I do since I am using IE6.0
Many thanks for your help,
Elahe


Thanks,
Elahe
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
try using this

<HTML>
<HEAD>
<TITLE>---</TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</HEAD>
<BODY>
Text in the Browser Window
</BODY>
<HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</HEAD>
</HTML>
No cache has major flaws in it...
Microsoft also sugeests putting the tags like show above. Some reason the browser likes to skip over the tags. IE 5 does not even recognize them (GREAT JOB MICROSOFT!!) See if that works. There is an ASP method too along with Netscape method.
Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
Eric I did try that too as bellow but still it doesn't work..
Whatelse do you want me to test?
Elahe
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Pragma-directive" CONTENT="no-cache">
<META HTTP-EQUIV="cache-directive" CONTENT="no-cache">
<META http-equiv="Expires" content="Tue, 01 Jan 1980 1:00:00 GMT">
James Swan
Ranch Hand

Joined: Jun 26, 2001
Posts: 403
Try this approach:
http://www.coderanch.com/t/352737/Servlets/java/dealing-caching-IE
Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
James,
thank you soooo much for your answer I read your solution which was:
---------
A common approach (and one that is successful) is to trick the browser in thinking it is requesting a new page each time.
This is done by appending a dummy variable to the query string of the url with a unique value (a timestamp is a good option).
eg. www.myserver.com?dummy=timeStampValue
This can be done using JavaScript and it's Date object.
James.
---------
but could you please describe more what do you mean by:
"appending a dummy variable to the query string of the url with a unique value (a timestamp is a good option).
eg. www.myserver.com?dummy=timeStampValue "
what should I do exactly I don't get it...
Many thanks for your help,
Elahe
James Swan
Ranch Hand

Joined: Jun 26, 2001
Posts: 403
I guess it all depends on how the user gets to your page.
For example, say you page is called "page1.html", you would generate a link (or an action on form) that would produce "page1.html?timeStamp=1234567", then the next time the user requests the page, it could be "page1.html?timeStamp=4567788", etc.
But if the user directly types the url in the browser, you're out of luck, as you have noticed that IE doesn't support no-cache directives.
Does that make sense?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Is this page going to be a link on your main page, or your main page. I have scripts somewhere that will do both things. I will scrounge them up and post links to them for you.
Eric
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Take a look at this:
http://www10.brinkster.com/a1ien51/Scripts/nocachescript.htm
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on NOT Cache....
 
Similar Threads
making pages sensetive in struts
Re: Navigation Restriction
disable the back button in webapplication
Question on cache control...
pressing back button after logout shows loggedin contents