Sending XHTML as text/html Considered Harmful

Ian Hickson has an published an intruiging paper on the case for avoiding XHTML.


Here it is in a nutshell:



  • Browsers decide how to handle a file based on the MIME type that the server sends with it.
  • HTML Web pages are identified with a MIME type of text/html.
  • Pages written in XHTML that are sent with a MIME type of text/html don’t benefit from any of the features of XHTML.
  • To benefit from the features of XHTML, pages must be sent as application/xhtml+xml.
  • The most popular Web browser (Internet Explorer 6) cannot view pages sent as application/xhtml+xml.

And all this time, I was ignorantly assuming that any well formed HTML page was XHTML. Well, you live and you learn.


UPDATE: I forgot to link to Ian Hickson’s paper http://www.hixie.ch/advocacy/xhtml.

Sending XHTML as text/html Considered Harmful
  • I’m "delurking" to leave a comment, but I think browsers handle xhtml vs html by inspecting the doctype element (which should be the first non comment line of a file anyway). If you accept XHTML as a descendant that evolved from HTML, then text/html seems perfectly acceptable.

    What seems to be proposed is like using application/pdf-4 and application/pdf-5 to differentiate between different versions of PDF. I’d be interested in exactly *which* features of XHTML a browser cannot handle when sent a mime type of text/html ?

  • Man, did I have a hard time figuring out what "delurking" was. http://www.easynet.net.au/mirrors/newbie-u/news/lurk.html helped me out.

    I forgot to link to Ian Hickson’s original paper (http://www.hixie.ch/advocacy/xhtml) which explains why it’s considered harmful.