Re: IE and XHTML 11

In response to Houser @ HouserDesign.com and his message at Foo’s blog:

There seems to be some misunderstanding about that IE supports XHTML. IE supports XHTML equally good as Netscape Navigator 4.x and Mosaic. Just because you can write an HTML document using well formed XML does not mean that is XHTML. Neither does adding invalid HTML attributes and tags.

To be correct XHTML your web server needs to send the application/xhtml+xml content type. Browsers that do understand this, use their XML parsers to parse the content and then applies the default XHTML CSS to this. If you send this content type to IE, it does not know what to do and it asks the user to save the file.

An alternative would be to send the document as text/xml. This should work in all browsers supporting XML+CSS. Once again IE falls short even though it states that it does indeed support this. The problem is that it does not know that is should trigger the XML to HTML XSLT that it does when it encounters i stylesheet PI. (Remember that using XML+CSS does not give access to DOM HTML 1/2 nor DOM0 which prevents usage of cookies and many more crucial parts of the DOM).

Note that IE uses HTML with custom elements in those few cases that it does know how to apply the CSS to XML. This means that it changes the tag names of all XHTML elements to uppercase. It also means that it adds HTML, HEAD and BODY elements which means that your CSS will most likely not work.

Conclusion

  • Mozilla 1.4 – Passed
  • Opera 7.2 – Passed
  • Opera before 7.2 – Failed
  • IE6Sp1 – Failed

Oh… I almost forgot (IE Rant #4)

  • http://www.forgetfoo.com/ foO

    whoa…. *claps ‘n cheerz* very nice, erik! :)

    explains it ALOT better than i ever could, that’s for damn sure… i also understand what you were say’n alot better now, too – in regards to IE’s non-existent support for ‘true’ XML+CSS, especially in regards to the header mime types.

    great example on the ‘document.documentElement.tagName’ in the comments on my site, too… charon and i noticed that while working on the XML FooMenu, and i found it really curious that all the tags back back in uppercase, much less the BODY, HEAD, TITLE, etc…. neither of us quite understood what the hell that was all about, y’know?

    now i do :)

    hmmmmmmm… maybe this is why i just couldnt seem to get raw XML data to be properly “included” in an XHTML 1.0 Transitional document? i tried using different namespaces, to no avail… and i especially couldnt get an XSL sheet to apply to the included XML data inside the document, either. *mutters*

    again, that’s one of the great things that i thought was about “XHTML”… ugh.

  • http://www.pewprod.com Pewprod

    I made a few experience with XML in IE, look at http://www.pewprod.com (WEBmr., Taratula and Wigboldus.info)
    They all just made for IE, and works not in another browser!
    But it works fine, but now to find out to made it that all browsers the site looks good.

    WEBmr. is a xhtml document that call’s data from XML docs, taratula and wigboldus.info are XML docs that use XSL.
    (forum is just a simple php-mysql forum, not need to look at it ;) )

  • http://erik.eae.net Erik Arvidsson

    webmr is text/html and it is not even well formed XML. Try renaming it to xml or xhtml and see what you’ll get.

    Taratula is raising an error because your web server is misconfigured. The mime type for XSLT is not text/plain. Use text/xml or application/xml.

    Wigboluds.info is incorrect due to the same reason.

  • http://www.pewprod.com Pewprod

    I change something in the webmr code, now is the page almost valid, 9 to go ;)
    The only thing is the xml inport.

  • http://erik.eae.net Erik Arvidsson

    It’s still served as text/html. As long as you are not serving it using application/xhtml+xml you are not using XHTML.

  • http://www.pewprod.com Pewprod

    My page is now This Page Is Valid XHTML 1.0 Strict. I must change a little bit on the info navigation (next/back).

    http://validator.w3.org/check?uri=http://webmr.pewprod.com/index.html&charset=(detect+automatically)&doctype=(detect+automatically)

    But how to change it from text/html to application/xml+xhtml

  • http://erik.eae.net Erik Arvidsson

    I see that you use Apache. Add the following line to
    your httpd.conf file

    AddType application/xhtml+xml .xhtml

    After this you should be able to just rename your xhtml files to xhtml and they should be correctly sent.

  • http://www.pewprod.com Pewprod

    Why is your website not Valid xhtml?

  • http://erik.eae.net Erik Arvidsson

    This weblog is not valid because too many users use IE and therefore I have to use text/html.

    There are other reasons and that is that Movable Type does not enforce well formed nor valid XHTML. I try to strive after well formedness but I guess there are some bugs due to missformed posts/messages.

  • http://www.houserdesign.com Houser

    Erik – check your facts before you make me look like I don’t know what I am talking about in your posts. I am not Houser@ClearDensity.com and my post to Foo had NOTHING to do with IE being fully XHTML compliant. My response to Foo’s blog post was simple to give him a working solution to a problem. That’s it.

  • http://erik.eae.net Erik Arvidsson

    Houser: I never ment this as a response to your post alone. There is/was a common belief that IE supported XHTML and I wanted to add my opinions about this.

    Sorry for the missundertanding about who you were. I changed the post to point to your site instead.

    Too bad Foo removed the comment ability from his blog :’(