Solved

Clearing the Cache in IE

Posted on 2002-05-23
9
813 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 5

Expert Comment

by:Yog
ID: 7030090
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
ID: 7030148
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
ID: 7030165
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
Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

 

Author Comment

by:johnclarke
ID: 7030174
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
 
LVL 5

Expert Comment

by:Yog
ID: 7030521
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
ID: 7030679
missed the , sorry try

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

Expert Comment

by:florisb
ID: 7039207
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
ID: 7039303
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
ID: 7047029
heym you had any luck with this  ?
0

Featured Post

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
What You Need to Know when Searching for a Webhost Provider
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

724 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