Re: *.xhtml filenames, mimetypes and and mathML problem

Masatran (Deepak), R. wrote:
> * William F Hammond <hammond@csc.albany.edu> 2006-02-23
>   
> Content Negotiation works well for my XHTML+MathML webpage
> <http://research.iiit.ac.in/~masatran/model/>. It is accepted as
> XHTML+MathML by XHTML-aware browsers. It is present in Google's cache at
> <http://64.233.179.104/search?q=cache:research.iiit.ac.in/~masatran/model/>.
> The only problem is that Google's cache serves it as plain HTML.
>   

Then instead of checking for the presence of "application/xhtml+xml" in
the accept variable (that, incidentally, leaves out Safari which
otherwise understands XML/XHTML just fine), you could also check for the
presence of "googlebot" in the user agent variable, and send that the
XHTML mime-type as well.

To make it even more complicated, consider the case where the user is
browsing with Internet Explorer and has the DesignScience MathML plugin
installed. His browser suddenly can accept application/xhtml+xml and
text/xml documents, and the page is *internally* converted to HTML (in
client memory) so that the MathML will render using IE's weird
implementation of HTML namespaces (it will actually internally rewrite
all the MathML to use an mml prefix, and insert two special tags into
the head of the document). Internet Explorer without the DesignScience
plugin will just either not understand the mime-type or display the XML
tree. Fortunately, the MathML plugin inserts a "MathPlayer" into the
user-agent of Internet Explorer, letting you detect it.

To summarize, for XHTML content negotiation, if the user-agent contains
"AppleWebKit", "Googlebot", or "MathPlayer", or the accept variable
includes "application/xhtml+xml", then you can send as
application/xhtml+xml, otherwise send as text/html.

-Jason Davis

Received on Friday, 24 February 2006 05:28:02 UTC