A mimetype of application/xhtml+xml? No thanks
Posted on July 13th, 2005
I came across a Blosxom plugin for serving pages as application/xhtml+xml instead of the standard text/html mimetype. But when I installed it, my page layout went kaput in Firefox. What gives? Internet Explorer was game, or at least seemed to be.
It turns out that mucking with the mimetype is probably not such a good idea. Anne's Weblog points to the Mozilla Web authoring FAQ, which reveals:
However, if you are using the usual HTML features (no MathML) and are serving your content as text/html to other browsers, there is no need to serve application/xhtml+xml to Mozilla. In fact, doing so would deprive the Mozilla users of incremental display, because incremental loading of XML documents has not been implemented yet. Serving valid HTML 4.01 as text/html ensures the widest browser and search engine support.
There is a fad of serving text/html to IE but serving the same markup with no added value as application/xhtml+xml to Mozilla. This is usually done without a mechanism that would ensure the well-formedness of the served documents. Mechanisms that ensure well-formed output include serializing from a document tree object model (e.g. DOM) and XSLT transformations that do not disable output escaping. When XHTML output has been retrofitted to a content management system that was not designed for XML from the ground up, the system usually ends up discriminating Mozilla users by serving tag soup labeled as XML to Mozilla (leading to a parse error) and serving the same soup labeled as tag soup to IE (not leading to a parse error).