[Skip to the Main Content]

HTML5 and http-equiv Difference

Differences between HTML and XHTML have been noted. Differences between HTML 4.01 and HTML 5 less so. The following identifies one difference that may seem insignificant but annoys me endlessly.

[Note: The following adressess HTML 5; not XHTML 5. All HTML 4.01 text/html and XHTML 1.0 text/html documents are considered to be HTML 5.1]

HTML 4.01 Specification, 7.4.4 Meta data states,

“The http-equiv attribute can be used in place of the name attribute and has a special significance when documents are retrieved via the Hypertext Transfer Protocol (HTTP). HTTP servers may use the property name specified by the http-equiv attribute to create an [RFC822]-style header in the HTTP response. Please see the HTTP specification ([RFC2616]) for details on valid HTTP headers.”

[Note: W3C specifications do not place use limitations.]

HTML 4.01 Specification, 5.2.2 Specifying the character encoding states,

“META declarations should appear as early as possible in the HEAD element.”

Whereas,

Web Applications 1.0 allows one (1) http-equiv: character set. And, it must be placed first in the <head> section.

Web Applications 1.0, 3. Semantics and structure of HTML elements, 3.8. Document metadata, 3.8.5. The meta element offers,

Metadata element
Contexts in which this element may be used:
In a head element.
Content model:
Empty.
Element-specific attributes:
name
http-equiv (HTML only, optional [Elementary emphasis.])
content
Predefined classes that apply to this element:
None.
DOM interface:
interface HTMLMetaElement : HTMLElement {
attribute DOMString content;
attribute DOMString name;
};

This site failed (X)HTML5 Conformance Checking Service for numerous requirements but the particular error was,

  • Error: The element meta with the attribute http-equiv is not allowed at this point. The attribute http-equiv is only appropriate for declaring the character encoding and in that case the element must be the first element child of the head element.
    Line 10, column 45 in resource http://www.elementary-group-standards.com/

Henri Sivonen kindly suggested that I read further down. I did.

3.8.5.3. Specifying and establishing the document's character encoding

“The meta element may also be used, in HTML only (not in XHTML) to provide UAs with character encoding information for the file. To do this, the meta element must be the first element in the head element, it must have the http-equiv attribute set to the literal value Content-Type, and must have the content attribute set to the literal value text/html; charset= immediately followed by the character encoding, which must be a valid character encoding name. [IANACHARSET] When the meta element is used in this way, there must be no other attributes set on the element, and the http-equiv attribute must be listed first in the source. Other than for giving the document's character encoding in this way, the http-equiv attribute must not be used.” [Elementary emphasis]

I had missed that. Or, not remembered.

The actual code which failed was,

<meta http-equiv="imagetoolbar" content="no">

The IE Image Tool Bar fix has been deprecated by HTML 5.

This site would have simple fixes. It would be to place the few images as CSS background-image. I am more concerned about about commerce sites. The simple fix has been <meta http-equiv="imagetoolbar" content="no"> but I doubt HTML5 shall allow it. I Googled for PHP or Java Script code which could replace the ubiquitous Imagetoolbar fix but I did not find any that were concise or suitable.

Does anyone know any IE Image Tool Bar blocking scripts?

  1. Web Applications 1.0, 1.4.1. HTML vs XHTML states,

    “There are various concrete syntaxes that can be used to transmit resources that use this abstract language, two of which are defined in this specification.”

    “The first such concrete syntax is “HTML5”. This is the format recommended for most authors. It is compatible with all legacy Web browsers. If a document is transmitted with the MIME type text/html, then it will be processed as an “HTML5” document by Web browsers.”

    “The second concrete syntax uses XML, and is known as “XHTML5”. When a document is transmitted with an XML MIME type, such as application/xhtml+xml, then it is processed by an XML processor by Web browsers, and treated as an “XHTML5” document. Generally speaking, authors are discouraged from trying to use XML on the Web, because XML has much stricter syntax rules than the “HTML5” variant described above, and is relatively newer and therefore less mature.”


Sean Fraser posted this on December 10, 2006 07:18 AM.

  • Add to Technorati Favorites
  • de.licio.us: http://www.elementary-group-standards.com/web-standards/html5-http-equiv-difference.html
  • furl: http://www.elementary-group-standards.com/web-standards/html5-http-equiv-difference.html
  • reddit: http://www.elementary-group-standards.com/web-standards/html5-http-equiv-difference.html

Comments

Nate K wrote this at December 11, 2006 06:21 AM

Wow, I find that pretty lame that it is deprecated in HTML5. I would say your best bet for a solution would be JavaScript (client-side) to get rid of the toolbar.

Even more annoyances by MS.....we wouldn't have to turn it off if it wasn't there in the first place.


Comment Author Gravatar
Sean Fraser wrote this at December 11, 2006 10:28 AM

Nate: My reason's aesthetics. And, simplicity. The WHATWG may make allowances for more than one http-equiv - after all, the specification is revised daily - later but it's annoying that a single line may need to be replaced by many.


Ian Hickson wrote this at January 3, 2007 03:40 PM

Thanks for the feedback. I'll make sure to take this into account -- maybe we'll have to allow http-equiv for this particular use case. (Another use case is http-equiv="Refresh", which we'll also have to look at.)

If you have any other feedback, feel free to post it to the whatwg list ([email protected]) or, if you don't want to subscribe to the list, feel free to e-mail me directly ([email protected]) so I can make sure to take your feedback into account.

Thanks!


Comment Author Gravatar
Sean Fraser wrote this at January 3, 2007 04:36 PM

Ian: It's nice to see you're back from Holiday.

I have written to you directly on numerous occasions and you were kind to reply. As for posting on WHATWG List, I may but as one of the "misguided" (as Henri S— noted) I may not. Did you know that Jeffrey Zeldman uses meta http-equiv="imagetoolbar" content="false"?


Comment Here

Reply guidelines: Basic HTML (a href, p, code, blockquote, dl, dt, dd, ul, ol, li, cite and q) are allowed. Line breaks and paragraphs are automated.


Inappropriate, unwarranted or self-aggrandizemented comments may suffer redaction. Or, deletion.

[Note: A gravatar, or globally recognized avatar, is that small image in the comments. Gravatar sets-up them.]

The Elementary Standards: A Compendium of Web Standards, CSS, Linguistics and Search Engine Optimization methodology Copyright ©2005-2007 Sean Fraser. All work is published under a Creative Commons License. All Rights Reserved.

Palm trees on a grassy field in Hawai’i

Main Content Returns thus