Enable HTML5 Application Cache on a DataSnap based web server

By default, stadalone WebBroker DataSnap servers do not allow to use the “new” HTML5 Application Cache file manifest.

While I was preparing the contents and the demos of my “HTML5 and DataSnap web application development” (with more than 250 slides and more than 50 samples. More info here) I’ve configured the DataSnap components to support this HTML5 feature.

There is only one change to do to the default “REST WebApplication” generated by the wizard.

In the WebModuleUnit there is the TWebFileDispatcher component used to deliver static (or “not-so-static” files like the javascript proxy) to the client. This component has the property WebFileExtensions that is a collection of key-value containing all the allowed file extensions with the related mime-type.

The following screenshot shows which is the change to do.



Add “appcache” extension with the “text/cache-manifest” mime-type.

Now your DataSnap server is ready to be an HTML5 compliant WebServer. Tested on Delphi XE3.

More info about the HTML5 Application Cache here.


comments powered by Disqus