The perils of MIME types and XHTML
According to the W3C, XHTML should be served with the application/xhtml+xml MIME type rather than text/html, which is used for plain old HTML, or application/xml and text/xml, which some people (incorrectly) use instead.
Until now, I’ve served my pages with text/html as Internet Explorer does not support application/xhtml+xml and offers your pages for download rather than displaying them as it should.
I found an article yesterday which details a way in which you can serve your pages with the appropriate type depending on the browser. A sample PHP script was also included. I took the script and modified it to serve my purposes, and now my pages are served as application/xhtml+xml if the browser supports it, and text/html otherwise.
However, that’s not the end of the matter. Serving your pages with the new type also means that you need to refactor some JavaScript that does not work, as well as applying CSS rules to html as well as the usual body and some other problems which may come to bite at unexpected times. 456 Berea Street has and excellent article detailing “The perils of using XHTML properly” along with examples of where code may need to be changed.
I had to go through all my pages fixing entities, unescaped ampersands and other such small problems that would not normally even show up. In the end though, moving now is much better than moving when you are forced to. It offers much more time to go through and fix your code as well as moving to newer software systems if these are also holding you back from valid code.