By design HTML5 Offline support (AppCache) works if client device is offline or client device is online and server is accessible. After that I cached the application and reopened it in the browser (of refresh it) when the device has no internet access the browser loads the application from AppCache. In this case the browser does not try to fetch appcache manifest (it understand that we're offline).
But let's consider a case when my device is not offline. It still has internet connection. But my server is down. There could be many different reasons for this (hardware failture, AppPool stopped, IIS throttling, DNS error and so on). In this case when I open a cached application in the browser it'll try to fetch appcache manifest and gets 404 error (not found). And after that the browser clears AppCache for the app! So on the next run it won't load it from AppCache and show 404 error "page". No more offline work.
It looks strange for me that offline mode functioning depends on a reason the server isn't accessible. Why should I care as a user (it's no internet connection or server is down)?
So my question is: do anybody know any way to make an application work when a device is online but its server isn't reachable?
Ideally I should be able to catch window.applicationCache's error event and tell it "it's ok, please continute to use the cache, do not obsolete it".