]> The LambCutlet Disorganisation » 2003 » March

The LambCutlet Disorganisation

How would sir like his XHTML served?

Posted by Jonathan at 19:49:00 UTC on the 8th of March, 2003

How should a webserver dish up XHTML? There’s been a fair bit of discussion posted in many places all over the Internet, but here is the abstract from the W3C:

This document summarizes the best current practice for using various Internet media types for serving various XHTML Family documents. In summary, application/xhtml+xml should be used for XHTML Family documents, and the use of text/html should be limited to HTML-compatible XHTML 1.0 documents. application/xml and text/xml may also be used, but whenever appropriate, application/xhtml+xml should be used rather than those generic XML media types.

What does this mean then? Well, as I use XHTML1.1 throughout, so according to the spec, I should always send such documents as application/xhtml+xml. However, at time of writing, the only browser which explicitly supports this media type is basically limited to Gecko based browsers, such as Mozilla.

Browsers such as Internet Explorer have no idea what to do with them, and will prompt for saving the file locally. Expected behaviour for unknown media types, but not a lot of good for effectively browsing a website.

Serving as generic XML, i.e.: application/xml, Internet Explorer would either show the document tree, or fail with an error along the lines of being unable to style the XML.

There is infact a test suit along with results from a number of browsers collated by Masayasu Ishikawa.

With further reading I decided to detect if application/xhtml+xml was an explicitly supported media type for the user-agent. If it was, excellent, send it as that; otherwise, “break” the XHTML1.1 specification, and fall back on to XHTML1.0 Transitional, and send content as text/html.

This worked very well, although there had to be minor corrections to the stylesheets as when a conforming user-agent is in the stricter X(HT)ML rendering mode, the <body> tag is no longer “magic” as it was in older HTML specifications. It’s behaviour relative to <html> is similar to a <div> nested within <body>.

So, my pages have been updated, if there’s anything awry, refresh your page. If it’s still FUBAR, let me know how it’s not working for you. :D

Filed under: Meta, Internet

phpBB 2.1/2.2 gallery updated!

Posted by Jonathan at 23:50:00 UTC on the 2nd of March, 2003

For those that haven’t noticed, I’m maintaining a gallery of screenshots for phpBB’s forthcoming version of BBS software; phpBB2.2, which is currently in pre-Alpha stage and on it’s way to Milestone 2.

Feast your eyes. :D

Filed under: Software