Index of /utilities/cgi/xhtml-for-ie

      Name                    Last modified      Size  Description
Parent Directory - 02-Jul-2006 16:20 2.0K Small perl utility which decides what MIME type to use example.xhtml 02-Feb-2001 00:16 650 XHTML document sent as application/xhtml+xml to Mozilla and text/html to IE
Getting MathML in XML to display in Internet Explorer

The problem:

   IE doesn't support XHTML, nor the combination of MathML namespaces
   and XHTML namespaces to combine MathML in HTML. It _does_ "support"
   what Microsoft calls "XML Islands", that is, XML fragments inside
   text/html. That's just Wrong, but there you go.

   Other browsers (like Mozilla) do the correct thing, and handle
   MathML in XML using namespaces.

The solution:

   Give everyone except IE files with the application/xhtml+xml MIME
   type, and give IE the text/html MIME type, and in all other
   respects give them the same file.

   To do this, I have written a small CGI script. To use it, add the
   following to the .htaccess file in the directory containing your
   XHTML+MathML files:

      # Convert XML files to HTML files if accessed by IE
      Action xhtml /virtual/path/to/this/directory/xhtml-for-ie
      AddHandler xhtml .xhtml
      IndexIgnore xhtml-for-ie
      <files xhtml-for-ie>
         SetHandler cgi-script

   You could of course put the CGI script anywhere, like a /cgi-bin/
   directory, and you could give it a .cgi extension or whatever you
   want. You could also call your files anything, here I have assumed
   they have a .xhtml extension but it could be anything. Here is an
   example of another possible fragment you could add to .htaccess to
   get the same end result:

      # Convert XML files to HTML files if accessed by IE
      Action application/xhtml+xml /cgi-bin/xhtml-for-ie.cgi

   This assumes that the script is in /cgi-bin/, that your files have
   been set up to return with application/xhtml+xml (typically this
   means having the .xhtml extension) and that files ending with .cgi
   are automatically assumed to be CGI scripts.

   Now install the CGI script, which you will find at

   To 'install' it you need to put it in the directory you selected
   when editing the .htaccess file. Don't forget to rename it as
   appropriate (e.g., removing the .pl extension).

   Now you are ready to start creating MathML files. To check it is
   working, try copying your directory. Assuming you used the first suggested change
   above (i.e., the .xhtml extension for MathML-in-HTML files) this
   should work in both Mozilla and IE.

Feel free to e-mail me if you have any questions:
Ian Hickson <>