htmlxhtmlmeta-tagsxhtml-1.0-strict

HTML5 vs XHTML Strict 1.0 (Metatags)


I got a question regarding validating the HTML code of my webpage. I have a XHTML 1.0 Strict webpage and I am trying to convert it to a HTML5 page. When I changed the doctype to the HTML5 format and run it against the the w3cvalidator and the validator.nu websites I got the following results:

Bad value Pragma for attribute http-equiv on XHTML element meta.
Bad value Expires for attribute http-equiv on XHTML element meta
Bad value CACHE-CONTROL for attribute http-equiv on XHTML element meta.

My HTML code:

<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />

I know that (after reading several topics on StackOverflow, like: Bad Values in Metatag, caching in HTML5 is different. But I still wonder why does those metatags works just fine within XHTML and not in HTML5? I do not quite get it.


Solution

  • They don't "work" in XHTML, clients still ignore them. The XHTML DTD just doesn't forbid them because it is only as specific as "This attribute should have some text in it".

    HTML 5 attempts to restrict meta data to stuff that actually does something useful.