Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Clearing the Cache in IE

Posted on 2002-05-23
9
Medium Priority
?
819 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
Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

 

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 200 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

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

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 …
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

604 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