I found this interesting article, Beware of XHTML, while browsing the web today. It explains many, if not all, of the misconceptions about XHTML, and why it’s probably best to continue using HTML 4.01.
I’ve always been of the opinion that writing standards-compliant XHTML 1.x is the best way to develop a website or a web application. By “standards-compliant”, I mean writing XHTML code that validates using the W3C Validator.
As it turns out, however, I have never written XHTML that is completely standards compliant, since I’ve never changed the MIME type specified by the web server when sending XHTML pages to
application/xhtml+xml. According to the article, unless the MIME type is specified as so, web browsers will continue to use their HTML parsers on your page, instead of their XHTML parsers. Unfortunately, Internet Explorer (even version 8 ) doesn’t even have an XHTML parser. So setting
application/xhtml+xml as the MIME type causes anyone who visits an XHTML web page to be prompted to download the file in Internet Explorer.
This practically eliminates the possibility of writing XHTML code that actually utilizes the XHTML parsers of web browsers. Even WordPress uses XHTML, but with the HTML MIME type (
text/html), which is not considered good practise by the author of Beware of XHTML, and indeed, most of the Web community. (See Wikipedia for more about this. There is some dissent on this opinion, which I think has value.)
The part that bothers me most about using HTML 4.01 is that it feels like a step backwards in progress. XML is a better metalanguage than SGML, the parent language of HTML. XML has many advantages, such as embedding multiple different languages in a single document. Why should we return to using an older standard? Well I found a pretty good explanation in the HTML 5 draft specification.
With all the major players in the web industry endorsing HTML 5, does XHTML have a future? Yes, according to Tim Berners-Lee. He describes why here. So I guess I shouldn’t feel so bad using HTML. Eventually we’ll make the switch, but just not yet.