Reputation: 1166
I want to set cache expiration for my html page after may be 10days
<META HTTP-EQUIV="expires" CONTENT="Thu, 12 Apr 2012 08:21:57 GMT">
So my question is
Please help...
Upvotes: 3
Views: 10679
Reputation: 201818
The tag has limited effect. In particular, it does not affect proxies, since they work on HTTP headers and do not parse HTML documents.
After the expiry time, browsers are expected to treat the copy of the page in their caches as stale and not use it but request for the page from the server (if online), at least conditionally (send if modified since such-and-such). This means that after any new request for the page, the copy received should not be cached at all. So yes, you should set a new expiry date, unless you really want to prevent caching.
The Expires
header or its meta
simulation needs to have a specific time mentioned. There are other ways to affect caches, see http://www.mnot.net/cache_docs/
Upvotes: 3
Reputation:
You need to use some kind of server-side scripting language (like PHP or ASP or JSP) to set that date dynamically. This is only a 'hint' and browsers may or may not even listen to it.
Upvotes: 2
Reputation: 63560
That is a hint telling browsers that they should keep the HTML in cache until the specified date. That means that, if the browser complies, then whenever it sees the same URL, it will not make a request to retrieve it, but rather it would take the HTML from its cache and show that instead.
Therefore you can safely generate a new time for each request, since the browser that's caching the page won't make the request anyway, and the browsers making the new requests will get an updated hint.
Note though that no one's forcing the browsers to comply, they may simply ignore the hint and make the request anyway.
Upvotes: 1