T
Toby A Inkster
Micah said:Can you tell me whether the majority (or, hopefully, all) of
XHTML-aware user agents announce this in their Accept header?
Gecko browsers announce it. Opera announces it from version Opera 7.20
(actually from one of the early betas of 7.20). AFAIK, these are the only
browsers that accept that Content-Type.
You might want to do a compromise of (in hopefully understandable
pseudocode):
if ( contains(http-accept-header,'application/xhtml+xml')
|| pcre_match(user-agent, '/Opera.[6789]/') ) {
outputheader('Content-Type','application/xhtml+xml');
} else {
outputheader('Content-Type','text/html');
}
I think that's more or less how I do it.
Also, is it possible to determine (I'm guessing not) whether,
e.g., XHTML 2.0 is accepted?
No, although both Opera 6+ and Gecko will handle XHTML 2 via their
generic XML+CSS support, as long as you explicitly define styles for all
new XHTML 2 elements. (I have been playing with XHTML 2 a bit)