Post Archive

› September 9, 2002

Sending XHTML as text/html Considered Harmful

  • Reported by Brian

Ian Hickson, a member of the Mozilla.org Browser Standards Compliance QA team and an invited expert in the W3C CSS Working Group, has written up a rant explaining why, in his opinion, it's not good to send xhtml with the mime type text/html.

"Sending XHTML as text/html Considered Harmful" (.txt)

Comments

1. September 9, 2002 03:21 PM

Quote this comment

Bob Posted…

Umm... pardon my ignorance, but when would you use the MIME type of “text/html” within a document? Wouldn’t that be a server-related thing?

2. September 9, 2002 03:28 PM

Quote this comment

Simon Willison Posted…

You wouldn’t. The article is about the mime type, which is specified in the HTTP headers sent out with the document. The point made is that sending XHTML files with a text/html mime type (which is what most web servers will default to doing) is a bad idea.

3. September 9, 2002 03:44 PM

Quote this comment

Nate Posted…

The article is enlightening, and the arguments are strong, but the conclusion doesnt make sense to me, why not continue adopting XHTML and then when enough browsers support the text/xml type, switch things over at the server level? Do we need to throw out the baby with the bath water?

4. September 9, 2002 04:41 PM

Quote this comment

James Posted…

Good point Nate, I would think that servers get updated/patched/maintained much more often then the average home pc. Send as text/html now, and in 2 years software companies can slap in a patch to change the http header for xhtml files. The point of using xhtml now besides its normal benefits is also to ween us in the new xml based standards.

5. September 10, 2002 12:18 PM

Quote this comment

Simon Willison Posted…

The biggest danger of sending as text/html is that the chances of invalid XHTML documents making it on to the web are very high. If an XHTML document is not at least valid XML it will be completely useless when “real” XML user agents start to make an appearance. If you validate religiously you should be OK, but it’s all too easy to miss a closing tag (in a blog entry for example) and invalidate the whole document. Modern browsers won’t complain, but the XML user agents of the future will be unable to parse the document at all.

6. September 10, 2002 12:41 PM

Quote this comment

Nate Posted…

Simon, this makes sense, except wouldnt it be better to continue creating XHTML and fix errors after the fact, rather than sticking to HTML 4.01 which would either not benifit from the XHTML format or require complete re-dos when the time comes?