XHTML, HTML and mime types
Posted by mholmes on 21 Dec 2006 in Activity log
In the process of debugging some problems with EMLS, Greg and I made some interesting discoveries with regard to XHTML and mime types. (Little of this is new info, but it should be documented, and IE7 changes things a little.)
- XHTML documents SHOULD always be served with a mime type of application/xhtml.
- In the past, we didn't do this, because IE6 could not display pages served with that mime type. Our solution was to serve XHTML pages as text/html.
- On Cocoon, the text/html mime type was achieved by means of a sitemap configuration of a serializer called "xhtml11_compat", which served documents with the XHTML 1.1 doctype but with the text/html mime type.
- When we tested with IE7, we discovered that it seems to be able to handle application/xhtml. Hurray! Now we can serve our documents with the right mime types...
- ...except that, curses! if a document is served with no file extension (for instance, if the index page of a site is served from a url ending in a slash, with no filename at all), then ALL Windows browsers (Firefox, IE7, and Opera) fail to display it properly (by which I mean that they display it as XML, so links are not clickable, etc.). We didn't test this on Safari/Konqueror.
- For EMLS, we worked around the problem by adding a sitemap redirect from the root / to the actual index.htm pipeline, so that you can never actually access a page from the root slash without a filename. This seems a reasonable compromise.