|P is for Practical|
OT: How do you serve up XHTML?by wfsp (Abbot)
|on Sep 15, 2007 at 13:59 UTC||Need Help??|
wfsp has asked for the
wisdom of the Perl Monks concerning the following question:
More accurately: if you serve up XHTML which mime type do you use?
Ian Hickson argues that Sending XHTML as text/html Considered Harmful.
Brad Fults, in: Sending XHTML as text/html Considered Harmful to Feelings, is not convinced.
The www.w3.org themselves seem to agree: Why is it allowed to send XHTML 1.0 documents as text/html?
What really attracted my attention was, as Ian Hickson suggests, opening http://www.mozillaquestquest.com/ in IE. It does indeed show a DOM tree (in IE7 as well as the IE6 that he mentions).
This was compounded by the apparent attitude of w3.org (excerpts from the link above):
Which browsers accept the media type application/xhtml+xml?Have I misunderstood something here? To my reading those statements could be considered contradictory.
The w3.org then describes a "a trick that allows you to serve XHTML1.0 documents to Internet Explorer as application/xml." It involves adding:
to every XHTML file and for the site to have the following file:
w3.org explain that:
Although you are serving the document as XML, and it gets parsed as XML, the browser thinks it has received text/html, and so your XHTML 1.0 document must follow many of the guidelines for serving to legacy browsers."Standards" that need "tricks" to work (for some definition of work) in a popular browser.
I find all this scary. I'm in favour of adhering to the latest standards and I bought into the idea of XHTML for all the reasons w3.org put forward. I have spent a lot of time and effort refactoring a medium sized website to validate against XHTML (amongst other things).
I must admit that at the moment I think Ian Hicks has the right idea:
Authors who are not willing to use one of the XML MIME types should stick to writing valid HTML 4.01 for the time being. Once user agents that support XML and XHTML sent as one of the XML MIME types are widespread, then authors may reconsider learning and using XHTML.The website I maintain has a non-techie audience and ignoring IE (however tempting that may be) is clearly not an option.
Do you serve up HTML or XHTML? If the latter, which mime type do you use?