Solved

Clearing the Cache in IE

Posted on 2002-05-23
9
812 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

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

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

742 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