[thelist] good practice META tags?

Keith Davis cache at dowebs.com
Fri May 25 23:26:40 CDT 2001

deke wrote:

> This thread is about "good practice META tags"

You're right. 

Which is why I'm pointing out that putting cache controlling directives,
either the expire, pragma, or cache-control type, in meta tags is not a
"good practice". They don't belong there except as a last resort or on
static pages where the expire date should be next year. 

The fact is, servers routinely send "Pragma:no-cache" and/or "Expires:
-1" headers to keep dynamic or frequently changing "resources" (not just
pages) out of the cache. 

<% Response.AddHeader "Pragma", "No-Cache" %> for ASP, 
print "Pragma: no-cache\n"; for Perl,
pragma no-cache in an htaccess directive works for PHP & SSI

The Pragma: no-cache and Expires: -1 mean exactly the same to browsers
(If the connection is secure do not cache at all, if it is unsecure
cache it only until the domain changes or the browser is closed - then
remove). The two mean different things to proxies and caching servers,
pragma forces a proxie or caching server to refresh while Expires: -1
does not explicitly force a refresh.

The only thing "illegal" about the Pragma, as a meta tag header or a
server header, is that IEFT forgot to write the damned response
specification, but every request *has* a response by definition. That
screwup on IEFT's part did not prevent server and browser manufacturers
from codifying amongst themselves how that response works. 

I apologize for not fully answering this when it first was asked:

>Can you name *any* circumstance in which the illegal "pragma" 
>header works and these headers don't?
><META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">

Yes, every time you use IE 4 or 5! IE *does* indeed know what to do with 
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> or a Pregma: no-cache
header but does *not* even recognize Cache-Control in a meta tag,
completely ignores it. Cache-Control is a header sent from the server
and has no place in a meta tag according to IE. Quote from

"Cache-Control META HTTP-EQUIV tags are ignored and have no effect in"
"Internet Explorer versions 4 or 5. To use Cache-Control this header"
"must be specified using HTTP headers as described in the"
"Cache-Control section above." (which describes the ASP header <%
Response.CacheControl = "no-cache" %>)

The main point is, using meta tags for cache control is not "good"
practice. By using server headers you can not only control the caching
of pages, reliably, but any component resource on the page.


More information about the thelist mailing list