I have been researching ways to achieve an offline HTML5 application in a corporate environment. I would certainly have no issues convincing the powers that be that HTML5 applications are the way to go and we should be developing new apps along that path.
alas, I am defeated by IE8. I’ll list the options that I came up with to make an HTML5 offline app viable in corporate-land.
- Use a Cache Manifest to get the browser to cache the files for the app and still open when offline.
IE8 does not support Cache Manifests, and neither does IE9. While we are constrained to supporting IE this won’t work until IE10 is approved through the company.
- Use Google Gears.
This means going through the hassle of getting google gears deployed to machines, and then building the app to specifically support google gears. Since gears is now deprecated this isn’t a very forward-looking solution.
Firstly, using the winforms WebBrowser control does not work as it defaults to IE6 rendering or something, so doesn’t know about local storage or any other web developments in the last ten years. I found suggestions that you can force it to run in IE8 rendering with some registry hacks, but that’s not something I’d like to be mucking around with on user’s machines just to get it to work. Also, this is a rubbish solution from Microsoft, having to change registry values instead of API methods/properties on the control itself.
- Create a WPF Wrapper Application.
Creating a simliar wrapper application with WPF was slightly better in that it ran as IE8 rendering and actually rendered the page properly. Problem is that LocalStorage is not available.
- Console application to launch IE8 with local file
Next attempt was making a console app as a Launcher to open the browser directly to the local file. This is not as tidy as the previous options, but at least it would work i thought. but no. Turns out files opened locally in IE cannot access LocalStorage as they don’t have a domain. This will have been what was blocking the option above as well it seems.
- WebKit.Net Browser Control
I grabbed the WebKit.Net project to be able to host a webkit browser control inside a wrapper application. This looked good at first – the app loaded and had no errors dealing with LocalStorage! if I saved data in LocalStorage and refreshed the page, it would still be there! looking good. Except that when you close the application the LocalStorage is cleared, obviously only held in memory while the control instance exists. If there was some way to capture the localstorage events through the webkit.net control then we could handle saving/loading ourselves, but there is nothing there right now so would be a fairly significant undertaking to get the LocalStorage working.
So, after all these options I’m pretty much out. Getting an HTML5 app working in offline mode in a corporate environment restricted to IE8 is certainly no trivial task.