views:

263

answers:

5

I have a web page that always needs to stay current. I do not want the browser to cache it. To that end, this meta tag is embedded with the page:

<meta name="Expires" content="Tue, 01 Jun 1999 19:58:02 GMT">

However, some browsers seem to ignore it. Chrome is particularly bad at it, though other browsers tend to do the same thing.

When I pick the page from the bookmarks bar, most of the time, it doesn't even hit the server, just loads it from cache. If I then press F5, it does go to the server and fetch a new copy.

Am I missing something simple? I thought the expires meta tag is the way it's done.

This is happening on an IIS 5.0 on Windows 2000.


Bottom line: looks like meta tags inside the HTML code pretty much do nothing. However, setting the expires tags within the HTTP does the trick nicely.

+5  A: 

Send your expires headers using your server. Specifically, if you're using apache, look at this:

http://httpd.apache.org/docs/2.0/mod/mod%5Fexpires.html

Paul McMillan
A: 
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

It will help you.

And for more useful meta tags : Click Here

You can also configure static content cache mechanism through IIS. To learn how-to please visit this website : http://support.microsoft.com/kb/247404

Braveyard
Why did they vote me down ? There is nothing wrong with the answer.
Braveyard
Because it is not the most effective way to do so. http://www.mnot.net/cache_docs/#META
Vineet Reynolds
+2  A: 

You want to send an Expires header set to a date in the past (like your Meta tag).

Expires is the most widely respected cache header, but you can also use things like Last-Modified, or Etags to get more specific control.

Meta tags are a somewhat outdated means of setting caching protocols, and most of the meta cache control properties are fairly deprecated (e.g. NO-CACHE). A lot of user agents ignore them.

Gabriel Hurley
+1  A: 

There is a great article I used to read about browser caching ans caching in general :

http://www.mnot.net/cache%5Fdocs/

It explains in high details what works and what does not, what is best to do.

In summary there are a lot of ways (html tags, HTTP headers) and types of cache (browser proxy, gateways)

MaxiWheat
A: 

Send Cache-Control: no-cache to the client within the response headers.
Please specify what platform are you using to make a better response.

Rodrigo