What began as a simple comment has turned into an adventure.
It started the other day with a thread on opera.wishlist about a validation mode in which the browser would stop and inform the user when there was a problem with their webpage.
The other day I was reading (as I do most days). On this particular day, Mark was . I can distinctly remember thinking to myself: a) Mark had a little too much time on his hands today OR Mark had very little time on his hands today and instead of doing what he was supposed to do, he ended up chasing a rabbit, b) only on the web could you find a brief history of the tilde along with your morning coffee (and people wonder why I don’t get the local paper… why would I, since I can get the highlights online, and I have a much more interested morning read for my morning routine?) and c) I remember thinking Dang… Mark just managed to make the history of the tilde an interesting read… I could learn to hate him for that.
(Jealousy is an ugly thing, but there it is anyway.)
Today, however, I am chasing my own rabbit, blissfully ignorant of the late hour of the day and the fact that I should be sleeping (which I’m not anyway, so why stare at the TV?).
So, it got really interesting when Rijk van Geijtenbeek of Opera Software (note that he mistakenly said “text/xhtml+xml” but meant “application/xhtml+xml”)
Why would he suggest this? Well because of the limitations of using text/html for XHTML documents, which are explained at the
XHTML documents served as ‘text/html’ will not be processed as XML, e.g. well-formedness errors may not be detected by user agents. Also be aware that HTML rules will be applied for DOM and style sheets.
Clearly I have been spending too much time at W3C, because these publications are starting to make more and more sense to me as I read them, and deep down in a place that I’m a little afraid to talk about, I’m starting to like them.
Of course I would point out here that all the specification says is that may not detect well-formedness errors. That does not seem to be prescriptive as much as descriptive — that is to say, they are describing how it is, not necessary how it should be. User Agents (known most often to us as browsers) could detect well-formedness errors. Which would mean, getting back to the original suggestion, the idea of having a ‘validation mode’ would be an appropriate option. With regard to Opera, there is already an option to display Javascript error messages, and the existence of such errors might cause there to be problems on the page. Why not follow that example and have an option to display XHTML and XML well-formedness errors? It seems likely to me that eventually this would be a good option to have when dealing with XML.
So I had to check it out. Sure enough, I made a poorly formed XHTML 1.1 document (specifically, I omitted an opening <p> tag).
Opera printed out as much as it could and then gave me the line number and column of the error.
Mozilla did mostly the same, except that it showed me the line in question, and did not show any of the first part of the document which was well formed.
Internet Explorer? Well, would you believe it prompted me to download the page? Yup, that’s right, the world’s largest company can’t even get a browser together that understands application/xhtml+xml.
So I decided to find out what my other options where.
For (geeky) reasons of my own, I am planning a section of this website which we be done to strict standards, meaning 100% compliant markup, including CSS and DOM. I planned (even before the thread about ‘validation mode’) to use XHTML 1.1.
So when I saw the , I was surprised by what it reminded me:
XHTML 1.1 documents should not be served with the ‘text/html’ MIME type.
Whoa.
Here I was planning a site to be the pinnacle of cutting edge standards compliance, and I nearly used the wrong MIME type for the whole bloody thing.
Now some would say that the W3C left wiggle room by using “SHOULD NOT” as opposed to “MUST NOT” which would prohibit it altogether…. but come on, we’re talking about moving towards the levels of advanced über-geekdom.
The preferred media type is application/xhtml+xml. Apache predefines that MIME type to correspond to documents that end with either .xhtml or .xht. So what happens if I try to use that?
In Opera: displays as web page In Mozilla: displays as web page In IE6: prompts to Open, Save, or Cancel
Hrm. The next choice is application/xml. Apache has no predefined file extension, so I added my own (.axml) using .htaccess and tried again:
In Opera: displays as web page In Mozilla: displays as web page In IE6: displays source to document (no, I don’t know why either)
Well, what about the last choice: text/xml (Apache: .xml or .xsl)? In Opera: displays as web page In Mozilla: displays as web page In IE6: same as application/xml, shows source
So my next thought was to try . This would allow different formats to be served based on what the browser tells you it is capable of handling. This would serve different content to different browsers, based on the expressed information coming to you from the browser itself.
IE6 correctly indicates that it can only handle text/html, and Mozilla correctly indicates that it can handle text/xml,application/xml,application/xhtml+xml,text/html.
Unfortunately, Opera only advertizes that it can handle text/html (…time passes as Tim shuffles off to file bug report…).
Update: Opera 7.2 fixes this bug
So I’m left with another WDD™ — Web Designer Dilemma — Do I follow the standards and make my life simpler, or do I worry about browser-specific hackery that will take more time and energy?
Well, fortunately for me, the site I was planning was primarily to be a sandbox to learn in, so I don’t need to worry about IE6 if I don’t want to… and guess what? I don’t want to.
So the site will be XHTML 1.1 and will be sent, according to the standards, as application/xhtml+xml.
Which means that it will work in Opera and Mozilla, and not IE. Sorry, Charlie.
†