XHTML and MIME types

This is an issue I’ve run across several times when building websites for work and for friends in the past few years.

Coding a webpage in XHTML isn’t exactly as straightforward as it appears to be, especially when you are trying to specify the correct MIME type to go with the page. Not all browsers support the MIME types some developers argue should be used with XHTML pages, and can cause some pages to be rendered and displayed in unexpected ways.

An article by Ian Hickson essentially outlines why XHTML shouldn’t be specified with a text/html MIME type. Another article from xml.com also discusses XHTML and MIME types and covers similar ground as well.

On the flip side, there are a lot of websites out there and blog publishing software (like WordPress) where XHTML pages specify a text/html MIME type.

Clear as mud, isn’t it?

So, what’s my stance on XHTML? Well, for some websites I’ve worked on in the past, if the scope of the website is very simple (a few pages’ worth), and the page layout and markup are straightforward, I stick to HTML 4.0 Strict, otherwise it’s HTML 4.0 Transitional. I have no qualms doing pages in XHTML (usually 1.0 Transitional), but it also depends on: the complexity of the page layout, if the markup on the page is static or dynamically generated in some sections and the intended audience for the website.

Leave a Reply