Solved

Clearing the Cache in IE

Posted on 2002-05-23
9
804 Views
Last Modified: 2013-12-24
Basically I need the page to be refreshed from the server rather than the cache whenever the user loads the page.  

I have tried an answer that has already been posted but this does not work.  I have added a copy of this answer to the end of this question.

I would be grateful for all help offered.

Thanks in advance

John

a newsgroup posting that may help:

> using the following headers I can get Netscape not
> to cache them:
> <html>
> <head>
> <META CONTENT="now" HTTP-EQUIV="Expires">
> <META CONTENT="no-cache" HTTP-EQUIV="Pragma">
> <META CONTENT="private" HTTP-EQUIV="Cache-Control">
> ...
> </head>
> <body>
> ...
>
> Note: For IE's sake, I also add the same <head> section at the end of
> the message (just after </body> and before the </html>). > This way you can also avoid the |@#$% IE5
caching mechanism.

CJ

This is tricky in IE but the most effective non-caching mechanism I have seen is:

<html>
<head>
<META HTTP-EQUIV="Expires" CONTENT="Fri, Aug 1 1980 09:00:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
</head>
<body>
....

</body>
<META HTTP-EQUIV="Expires" CONTENT="Fri, Aug 1 1980 09:00:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
</head>

HTH,
CJ
0
Comment
Question by:johnclarke
9 Comments
 
LVL 5

Expert Comment

by:Yog
Comment Utility
What CJ said should work, do you have a proxy setup in your network, maybe you can set expiry to a negative number i am not sure 86400 * -400 or 0.
0
 
LVL 11

Expert Comment

by:jimmy282
Comment Utility
no need of all this.
Just append a dynamic URl to the end of each page.

e..g

<cfoutput>
http://somepage.cfm?me=rand()
</cfoutput>

Now this Page will always come form the server cause its not in the cache.

You can make your own algorithm for generating Random Numbers or just use #CreateUUID()# or #Now()# .

HTH
Jimmy
0
 

Author Comment

by:johnclarke
Comment Utility
Yes,  we have a proxy setup on our network.  Could this cause CJ's solution not to work even if the script in question produces its results dynamically from a database ?

Basically the problem mainly occurs with images (the path for the image is stored in the database and then output in the html within an img tag.

I would be grateful for all advice offered regarding how to solve this problem.

Thanks in advance

John
0
 

Author Comment

by:johnclarke
Comment Utility
Jimmy,
      There are too many URL's to add this to and very little time in which to add it to them.  An alternate solution is really needed for this.

I know the solution you suggested will work but for this situation it does not solve the problem.

Thanks

John
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 5

Expert Comment

by:Yog
Comment Utility
W3 standards doesn't imply that the above code will avoid caching, HTTP 1.1 has more options for cache-control parameter.

The theory is here

Interesting Cache-Control response headers include:

max-age=[seconds] - specifies the maximum amount of time that an object will be considered fresh. Similar to Expires, this directive allows more flexibility. [seconds] is the number of seconds from the time of the request you wish the object to be fresh for.
 
s-maxage=[seconds] - similar to max-age, except that it only applies to proxy (shared) caches.
public - marks the response as cacheable, even if it would normally be uncacheable. For instance, if your pages are authenticated, the public directive makes them cacheable.

no-cache - forces caches (both proxy and browser) to submit the request to the origin server for validation before releasing a cached copy, every time. This is useful to assure that authentication is respected (in combination with public), or to maintain rigid object freshness, without sacrificing all of the benefits of caching.

must-revalidate - tells caches that they must obey any freshness information you give them about an object. The HTTP allows caches to take liberties with the freshness of objects; by specifying this header, you're telling the cache that you want it to strictly follow your rules.

proxy-revalidate - similar to must-revalidate, except that it only applies to proxy caches.

-------
so, i guess worth trying like

Cache-Control: max-age=3600, must-revalidate, proxy-revalidate

i MEAN

<META HTTP-EQUIV="Cache-Control" CONTENT="max-age=3600, must-revalidate, proxy-revalidate">

I am not sure wheather this will have a effect on proxy bandwidth performance,

or guess try without proxy-revalidate

<META HTTP-EQUIV="Cache-Control" CONTENT="max-age=3600, must-revalidate">
0
 
LVL 5

Expert Comment

by:Yog
Comment Utility
missed the , sorry try

<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, max-age=3600, must-revalidate">
0
 
LVL 2

Expert Comment

by:florisb
Comment Utility
From the coldfusion help:

The following example forces the browser client
to purge its cache of a requested file.
<CFHEADER NAME="Expires" VALUE="#Now()#">

Cu,
Floris.
0
 
LVL 5

Accepted Solution

by:
Yog earned 100 total points
Comment Utility
this is from asp section

<%'-- PAGES CACHING CONTROL --
 '-- Use the following script at the extreme beginning of the specific ASP pages

'-- Prevent caching at the proxy server
Response.CacheControl = "no-store" ' HTTP 1.1 Cache-Control header : prevent all caching of a particular
Web resource
'Response.CacheControl = "no-cache" ' HTTP 1.1 Cache-Control header : prevent all caching of a particular
Web resource
'Response.CacheControl="private" ' HTTP 1.1 Cache-Control header : prevent the caching at the proxy
server
'' Response.CacheControl="public"     ' HTTP 1.1 Cache-Control header : enable caching at the proxy
server

' Prevent clients from caching web pages :
' no-cache prevents caching only when used over a secure (https://) connection.
' Treated identically to Expires: -1 if used in a non-secure page.
Response.AddHeader "Pragma", "no-cache" ' (META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE")
'Response.AddHeader "cache-control", "no-store"
' Note the Web page may still be cached in the Temporary Internet Files folder.
' see http://support.microsoft.com/support/kb/articles/Q222/0/64.ASP for reasons & resolutions
 
'-- Set page expiration date
Response.Expires = -1 ' cached but marked as immediately expired. (META HTTP-EQUIV="Expires" CONTENT="-1")

''Response.ExpiresAbsolute = Now() -1
' However, the page remains in the disk cache ("Temporary Internet Files") and is used in appropriate
situations
' without contacting the remote Web server, such as when the BACK and FORWARD buttons are used to access
the navigation history
%>
0
 
LVL 5

Expert Comment

by:Yog
Comment Utility
heym you had any luck with this  ?
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now