[whatwg] Configure Apache to send the right MIME type for XHTML
kornel at osiolki.net
Wed Mar 7 13:11:15 PST 2007
On Wed, 07 Mar 2007 17:46:43 -0000, Elliotte Harold
<elharo at metalab.unc.edu> wrote:
>>> How so?
>> Well, your article advocates sniffing specific user agents where the
>> one written by Mark Pilgrim uses the Accept: header which was actually
>> designed for this... Google, for one, is known for not supporting XHTML
>> really well.
> I'm not doing content negotiation here.
From HTTP point of view you are.
> There's one representation available. It is XHTML. We can send that to
> most browsers and they'll deal reasonably. Two I know of have problems
> (IE and Lynx) so we lie to them and tell them it's text/html.
Use of Accept does not require you to return completly different
representations, you can use it just like you used User-Agent.
However Accept contains exactly the information you're trying to (and
failing to) derive from User-Agent header.
> I am curious what problems Google has with XHTML. Then they deal.
Last time I checked they were marking XHTML documents as "Unknown format".
Since Google certainly has engineers aware and capable of fixing this
problem, Google must be ignoring XHTML deliberately. I suspect they
support only what works for their customers and XHTML in XML mode doesn't
work for vast majority of them.
User-agent sniffing is a bad practice - it's inaccurate, hurts minority
browsers and is not forward-compatible. Please change your method to use
Accept header, so it won't be affecting any HTML-only user-agents (web is
more than a handful of desktop browsers). Accept method will even work
for MSIE and Lynx when/if they start supporting XHTML.
Even your regular expressions for User-Agent aren't doing exactly what you
intended, because mod_rewrite does not anchor patterns.
regards, Kornel Lesiński
More information about the whatwg