To ‘X’ the HTML or not?

I confess that I don’t really understand much of this discussion. However, my site is served as XHTML to browsers that support it (Internet Explorer doesn’t support application/xhtml+xml, hence the notice given to those users), so does that mean I’m pro-XHTML? And first of all, what is XHTML?

XHTML, eXtensible HyperText Markup Language, is based on XML, and thus is different from normal HTML. Some people call it the “future and cool” version of HTML It’s “supposed” to encourage stricter coding habits. So all that people do is change all their tags to lowercase, substitute “>” with “/>”, add a doctype, and proclaim “My site is XHTML compliant!”. Those who go a bit further would make sure their site validates in

However, one serious mistake is shown by (almost) all so called “XHTML” users. They continue serving XHTML as text/html, when the correct MIME-type for XHTML is application/xhtml+xml . This causes a totally different rendering engine used by the browser to be used when rendering the site. So, even though they might have made a simple mistake such as forgetting to close a tag, their sites may continue to load as long as they serve as text/html. And down the road when they (possibly) change to the correct mime type, their page breaks. Doesn’t even load a single thing. Trust me on this, it’s happened to me.

And what advantages does XHTML have? Well, as the eXtensible suggests, we are able to use it in some XML applications. For example, I’m using MathML in this site. XHTML also has the potential to be rendered ‘slightly’ faster than normal tag-soup based documents.

i personally feel that XHTML is okay to use, as long as you know the issues and don’t fall for the same mistakes. Or if you have need for MathML or similar. But for the moment you’ll have to use content-negotiation to figure whether to send XHTML or HTML.

Visit The Autistic Cuckoo or 456 Berea Street for more details.

EDIT: This is all wrong. So wrong. I have been looking around the net, at pages who “claim” to use XHTML, even some websites who write about XHTML, but they’re serving it as text/html! And some sites are littered with Javascript document.write junk which does not work in XHTML, except that they are serving it as HTML, and it works, so they think it’s okay? I stand corrected if I’m wrong. Please tell me.

1 thought on “To ‘X’ the HTML or not?”

  1. I think the first question a web author should ask himself or herself is, “do I *need* XHTML?”

    If you are using XML-based features like MathML or SVG, then the answer is yes. If you can serve the pages as text/html, the answer is most likely no.

    The thing that annoys me the most is all those people who spread lies about XHTML being “stricter” or even “more semantic” than HTML, even though XHTML is only a reformulation of HTML as an application of XML. I recently saw a post where a bloke claimed that writing tags and attributes in lowercase was more “strict” than using uppercase…

Leave a Reply

Your email address will not be published. Required fields are marked *