XHTML 1.0, Internet Explorer, application/xhtml+xml

Last Modified: Tue, 03 Feb 2009 16:07:00 +0000 ; Created: Tue, 03 Feb 2009 16:07:00 +0000

So Internet Explorer 6, 7, and 8 do not support XHTML whereas pretty much every other browser does. This is unfortunate because XHTML provides a nice well formed document layout.

One can simply set the mime type to text/html to get IE to work around the problem, but you lose some advantages of the XML validation.

So I read the FAQ from w3.org on how to work around IE. Since I am writing a Java application whenever it sees that the User-Agent browser header contains MSIE I have it modify the content type from "application/xhtml+xml" to "application/xml" instead. This could be done via Apache HTTP server for static pages too.

Basically to get it to work I just followed the instructions from w3.org with the exception that I had to leave out the DOCTYPE in my documents to avoid errors in IE.

So standards compliant browsers (Firefox, Chrome, etc) get "application/xhtml+xml" whereas IE gets just "application/xml" for the content type. This allows my XHTML pages to render correctly in all browsers.