Re: XHTML2 MIME type

On Fri, Apr 11, 2003 at 04:01:57PM +0200, Bjoern Hoehrmann wrote:
| Indeed, but using the XHTML 1.0 media type for incompatible XHTML 2.0
| documents could be a major hindrance to early adopters of XHTML 2.0,
| since it would be rather hard if not impossible to determine whether
| the user agent supports XHTML 2.0 on the server side. 

This is already the case. The Accept header is simply not a reliable way 
of determining which user agents can handle XHTML 1.1. e.g. Opera 6 and 
above can handle it, but they don't say so in the Accept header. OTOH, 
most browsers seem to list */* in the Accept header, which suggests they 
will accept application/xhtml+xml!

Currently, I just use something along the lines of:

if ( ($ua =~ m/Opera.7/) || ($su =~ m/Gecko/) ) {
	print "Content-Type: application/xhtml+xml\n\n";
} else {
	print "Content-Type: text/html\n\n";
}
# now send the xhtml 1.1 document

It is far from ideal, but until browser start using the Accept header in 
a useful manner, it is what needs to be done. There is no reason not to 
extent this to XHTML 2:

if ( ($ua =~ m/Opera.8/) || ($su =~ m/Gecko.2/) ) {
        print "Content-Type: application/xhtml+xml\n\n";
	# and now send an xhtml 2 document
} else if ($ua =~ m/MSIE.7/) {
        print "Content-Type: application/xhtml+xml\n\n";
        # and now send an xhtml 1.1 document
} else {
        print "Content-Type: text/html\n\n";
	# and now send an xhtml 1.1 document
}

(assuming Microsoft finally builds some support for XHTML into IE 7!)

-- 
Toby A Inkster BSc (Hons) ARCS | mailto:tobyink@goddamn.co.uk | pgp:0x6A2A7D39
    aim:inka80 | icq:6622880 | yahoo:tobyink | jabber:tobyink@a-message.de
            http://www.goddamn.co.uk/tobyink/ | "You've got spam!"
                             playing://(nothing)

Received on Friday, 11 April 2003 12:41:00 UTC