XHTML, SVG and MathML

·

I've been producing XHTML pages, with inline SVG and MathML. For older browsers, this is replaced by HTML pages, SVG in object elements and alternate images for MathML. The difficulty is in knowing which browsers can handle which formats: ideally this would be explicit in Accept headers, but browsers don't do this very well.

Firefox explicitly asks for XHTML, but not SVG or MathML; it gets all of them anyway, as Firefox 1.5 has built-in support for displaying both SVG and MathML.

Anything else that asks for XHTML also gets inline SVG and MathML. If they can't handle them then they probably just leave a blank space, which is unfortunate.

Any browser that doesn't explicitly ask for XHTML (including Safari, which says it accepts */*) gets HTML, SVG in an object element and MathML as an image. Unfortunately, sending HTML to Internet Explorer means that the MathPlayer plugin can't be used to display inline MathML, which has to be in XHTML.

IE7 can handle transparent PNGs, apparently, but not XHTML or SVG or MathML (except for when plugins are installed for SVG and MathML). Browsers don't tend to advertise in the Accept headers when they have plugins installed though, so the best response seems to be to put both SVG and MathML in object elements in HTML, that way a fallback image can be set for when the plugin isn't installed. I think MathML might have to be inline though.

In XHTML the SVG/MathML transformation could be useful to automatically add object wrappers when needed, but it seems to break validation.

Firefox on Mac OS X still has a bug where it throws a pop-up window the first time in every session that it encounters a MathML page, saying that the needed fonts aren't installed (even after installing them).

Safari doesn't seem to show alt text for images when the image file doesn't exist, so just leaves a blank space if there's no MathML alternate image.

In summary, IE and Safari aren't very good, and Firefox could be better. This could (and should) be easy.