Posted: 2003-01-31 03:12:43 UTC by Xiven | Cross-references (0) | Comments (11)
And does Google include application/xhtml+xml in it's Accept: headers? Ok, maybe it Accept:'s text/xml or so, but with a higher weight than text/html?
To be honest I don't know, I haven't actually looked at the Google Accept header.. The way this site decides which to send is: if the Accept header _explicitly_ mentions support for application/xhtml+xml or if the User Agent is in the list of known supporting user agents, send XHTML otherwise send HTML. I had mistakenly added Googlebot into this list (I had been led to believe that it supported it). I've now removed it, and it's all better: http://www.google.com/search?q=xiven
The list of supporting UAs is currently: W3C_Validator, WDG_Validator and Opera (with version >= 6). Gecko isn't in this list since it sends the Accept header anyway.
Obviously browser sniffing always has problems, specifically those of public caches. This site uses the HTTP 1.1 "Cache-control: private" header, but this doesn't guarantee that it won't get cached publically. Ah well...
There's a discussion about document.write not working under application/xhtml+xml in Mozilla here: http://www.dhtmlcentral.com/forums/topic.asp?TOPIC_ID=15994Bugzilla bug: http://bugzilla.mozilla.org/show_bug.cgi?id=111514
Further to this, in Opera 7.02 the <script> element is non-functional with XHTML sent as application/xhtml+xml
YES I USE GOOGLE FOR MY SEARCH ON MY HOME PAGEWITCH IS HTTP;//KNOLOGYHOME.NET, IN GOOGLEWHEN I WANT TO TYPE A WORD FOR GOOGLE TO SEARCHTHE CURSOR MOVE'S REAL REAL SLOW ALSO, IT WANTTO HANG UP
The Googlebot uses a varying Accept header. Usually it uses:
Accept: text/html, application/*
Which means that text/html is favoured but application/xhtml+xml is acceptable.
"The way this site decides which to send is: if the Accept header _explicitly_ mentions support for application/xhtml+xml or if the User Agent is in the list of known supporting user agents, send XHTML otherwise send HTML."
Firstly, you need to list the User-Agent header in your Vary header. Secondly, the mechanism you describe is flawed in that it will serve application/xhtml+xml to user-agents that prefer text/html.
I have long since changed the way I do this for the very reason that it is just plain wrong, broken and bad for caches (see http://www.xiven.com/weblog/2003/11/30/Upgrades). There are still some basic flaws in my Accept header use though:
Accept: */*;q=0.2, application/xhtml+xml;q=0.1
currently causes the site to send application/xhtml+xml as it is a more specific match. When I get around to it, I will fix it.
I suspect that document.write is a "bad" thing with regards to XML. depending on what get's sent to it, it could invalidate the XML or even make it not well-formed - thereby loosing the benefits of XHTML. I can only imagine that Firefox that the page is only parsed for well-formedness when it loads. Running scripts which can break things might break firefox in various ways or at least force it to re-parse the document every time it carries out a document.write request. In the event that a parse fails AFTER a page is already loaded, the user may be "confused" or otherwise upset.
I can see why they would have left it out. the only question is, why do the other browsers still support it inside valid XML?
I don't think it is part of the dom spec. I'm sure someone can confirm/deny this.
Add a comment
Website design and content copyright © 2002—2020 Thomas Pike.