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.
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.
Take out the XML declaration, it isn't strictly necessary and causes IE6 to be rendered in quirks mode. You should use XHTML 1.0, which allows documents to be rendered as text/html for backwards compatibility with HTML 4.01.
The only way to use the XML declaration in standard mode is with an XSLT stylesheet to transform it.
精彩评论