Solved

Clearing the Cache in IE

Posted on 2002-05-23
9
807 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
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
 

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

Question has a verified solution.

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

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

18 Experts available now in Live!

Get 1:1 Help Now