문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top