Should you really use XHTML?

I'll admit that in recent months I've been telling people with invalid mime types on their "XHTML" websites to use HTML 4.01 Strict instead.

The reason for this change of heart is that too many people are unable (or unwilling) to change their servers to send XHTML content as application/xhtml+xml (or some other permitted type). This is a bad thing. XHTML should always be sent as an XML-accepted mime type. Failure to comply results in the user agent falling back on user-prediction algorithms.

Why should I switch?

If you're able to send XHTML with the right mime type you don't need to switch at all! However...

Sometimes sending application/xhtml+xml isn't enough. Sometimes you're faced with a user agent, such as Internet Explorer that will render XHTML correctly when sent as text/html and not with the proper XHTML mime types.

In such cases the webmaster needs a method to smartly decide which mime type gets sent. Click that link for a snippet of PHP that I use on this website to determine what mime type to send your browser.

However, sometimes you are stuck with a web host that does not offer any method to change the mime type sent on outgoing files. In this case you should use HTML 4.01 Strict since it is likely that the host will send those documents as text/html, and just about every user agent can render that properly. Using HTML 4.01 Strict where XHTML is a bad choice (as described above) can make sure your content is rendered as you intend.

Breadcrumbs ?
  1. Projects - Index
  2. Musings -- Index
  3. Projects - Index
  4. Journey to a UK Civil Partnership
  5. Site Information - Site Map