views:

125

answers:

2

What's the rule for character casing in html tags?

I have a situation where I need to force no caching on a site of mine. I have been using all lower case for all html tags and attributes (being under the impression that it's case insensitive). I haven't had any issued from this, until now.

I have found that the following works on IE7:

<META HTTP-EQUIV="Expires" CONTENT="-1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

While this does not:

<meta http-equiv="Expires" content="-1">
<meta http-equiv="Pragma" content="no-cache">

FYI I am using PHP and also included the following, but it does not seem to work without the HTML meta tag as well:

header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
header("Content-Type: text/html; charset=UTF-8");

EDIT (Added): We have the following doc type (I must admit I am not leet enough to know what this means or how relevant it is)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
+1  A: 
jostster
A: 

Well... the META tags shouldn't really have no effect at all, because you are already sending real HTTP headers, which should override the headers specified as meta tags (HTTP-EQUIV is what the name says - substitute for HTTP headers when they aren't available).

Also... in HTTP header you say "Expires" = "Mon, 20 Dec 1998 01:00:00 GMT", but in meta tag you specify that "Expires" = "-1". So you aren't really sure what you want the Expires value to be?

Besides that: cache control should be achieved with HTTP headers alone - how else can you control how images are cached (there are not meta-tags in image files).

Rene Saarsoo