This month I have a rant, I am not a big fan of rants in blog posts as they never really seem to achieve much and really just seem to be be a bit self promoting. However I’ve not had one before and last month I came across a topic that is worthy.

I’ve started a pet project to write a browser based HTML5 app. In the past we have produced a version of a Windows Mobile app that ran in a browser it was interesting but not really a great experience. Its advantage was nothing needed to be installed and it worked on most devices however it did required an internet connection.

I’ve always thought that an app the can handle online and offline operation would be useful and interesting to produce, I need to get better at using Javascript and at last HTML5 seems to have progressed to the point that its useable. So I started putting together some proof of concept code, the part of HTML5 that makes offline apps possible is appcache. Its a file that you include in your web site and reference from HTML its main purpose is to specify to the browser which parts of your app can be cached and which cannot, a part being a URL.

Part of the magic depends on the appcache file being returned with the correct MIME type, as it says on w3schools

A manifest file needs to be served with the correct MIME-type, which is "text/cache-manifest". Must be configured on the web server.

My host (godaddy) is windows IIS7 based, and given the background reading I’d done that the recommended file extension was changed from manifest to appcache to avoid a clash with a Microsoft used extension almost two years ago I thought that all would be well. Wrong. The MIME type is still not set by default in IIS.

Here is my rant.We download megabytes of data every “patch Tuesday” and two years later IIS still has not had its MIME types updated.

Luckily I came across this life saving post and added this to my web.config and offline apps work.

  <system.web>
    <httpHandlers>
      <add verb="GET,HEAD" path="*.appcache" type="System.Web.StaticFileHandler" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".appcache" mimeType="text/cache-manifest" />
    </staticContent>
  </system.webServer>