xhtmlinternet-explorer-6doctypequirks-modexml-declaration

Can I have an XHTML document with an XML declaration in standards mode for IE6?


I've been reading about this for the last half hour, and here's what I understand:

IE 6 will render a page in standards mode if there's a valid DTD, but not if there are any comments above the DTD.

The XML declaration is a comment that goes above the DTD.

If the XML declaration is wrapped in a conditional comment, the page will render in IE 6 in quirks mode but be invalid XHTML.

Are there any workarounds to getting valid XHTML with an XML declaration to render in standards mode in IE6? If not, what are the disadvantages of removing the XML declaration entirely?

Thanks.


Solution

  • No work arounds. Technically you could use browser sniffing, but that generally frowned upon.

    you can't really use xhtml1.1 with xml in IE 6, because the content-type requires it render as xml. i.e. Content-Type: application/xhtml+xml which dies in IE.

    you should be using xhtml 1.0 with just the doctype and send the content type as text/html.