Is XHTML supported wide enough for everyday use? 25.07.06

Today I stumbled upon an article by Lachlan Hunt which lists some of the problems with using XHTML for webpages. After having read through it, I was nearly ready to reimplement my XHTML pages in HTML… The main cause for this was IE’s lack of support for application/xhtml+xml content. It won’t render it, but instead provides you with a standard download dialog. Serving XHTML as text/html, like most people do nowadays is actually fooling older user agents (like IE) to treat the page as good ole’ HTML. But there were a lot of other issues with XHTML I didn’t like the sound of either.

This would actually make my employer have to use HTML Transitional, since some of the ad serving is done using <iframe>, which isn’t allowed in the strict doctypes. You can read more on the differences between strict and transitional markup here. I might be arrogant, but HTML4 Transitional sounds a bit too nineties for me to accept, even if it is an acknowledged standard. ;-)

Luckily, the XHTML specs states that text/html is ok to use for XHTML documents, and they even included a thorough appendix on how to make sure your XHTML document renders correctly in browsers that treat it like HTML. Very good reading, and it contained several implications I weren’t aware of!

Edit 1: There’s an article over at workingwith.me.uk about sending mime headers depending on what the user agent supports. Highly recommended reading. Works like a charm here. :) Though I was a bit shocked to notice that W3C’s validator doesn’t send the correct ACCEPT-headers.

Edit 2: W3C has a table with the definitive overview of contenttypes for the differenct specs.

Edit 3: The code from www.workingwith.me.uk har some bugs if a browser explicitly states it does NOT want application/xhtml+xml. I rewrote my handling using some code from www.autisticcuckoo.net which seems to work more reliably (setting Q to 1 as default).