Offline iOS web app: loads my manifest, but doesn't work offline Offline iOS web app: loads my manifest, but doesn't work offline ios ios

Offline iOS web app: loads my manifest, but doesn't work offline


I confirm that name 'cache.manifest' solved the offline caching problem in IOS 4.3. Other name simply did not work.


I found debugging HTML5 offline apps to be a pain. I found the code from this article helped me figure out what was wrong with my app:

http://jonathanstark.com/blog/2009/09/27/debugging-html-5-offline-application-cache/

Debugging HTML 5 Offline Application Cache by Jonathan Stark

If you are looking to provide offline access to your web app, the Offline Application Cache available in HTML5 is killer. However, it’s a giant PITA to debug, especially if you’re still trying to get your head around it.

If you are struggling with the cache manifest, add the following JavaScript to your main HTML page and view the output in the console using Firebug in Firefox or Debug > Show Error Console in Safari.

If you have any questions, PLMK in the comments.

HTH,
j

var cacheStatusValues = [];cacheStatusValues[0] = 'uncached';cacheStatusValues[1] = 'idle';cacheStatusValues[2] = 'checking';cacheStatusValues[3] = 'downloading';cacheStatusValues[4] = 'updateready';cacheStatusValues[5] = 'obsolete';var cache = window.applicationCache;cache.addEventListener('cached', logEvent, false);cache.addEventListener('checking', logEvent, false);cache.addEventListener('downloading', logEvent, false);cache.addEventListener('error', logEvent, false);cache.addEventListener('noupdate', logEvent, false);cache.addEventListener('obsolete', logEvent, false);cache.addEventListener('progress', logEvent, false);cache.addEventListener('updateready', logEvent, false);function logEvent(e) {    var online, status, type, message;    online = (navigator.onLine) ? 'yes' : 'no';    status = cacheStatusValues[cache.status];    type = e.type;    message = 'online: ' + online;    message+= ', event: ' + type;    message+= ', status: ' + status;    if (type == 'error' && navigator.onLine) {        message+= ' (prolly a syntax error in manifest)';    }    console.log(message);}window.applicationCache.addEventListener(    'updateready',    function(){        window.applicationCache.swapCache();        console.log('swap cache has been called');    },    false);setInterval(function(){cache.update()}, 10000);


Sometimes an application cache group gets into a bad state in MobileSafari — it downloads every item in the cache and then fires a generic cache error event at the end. An application cache group, as per the spec, is based on the absolute URL of the manifest. I've found that when this error occurs, changing the path to the manifest (eg, cache2.manifest, etc) gives you a fresh cache group and circumvents the problem. I can vouch that all of our web apps work offline in full-screen with 4.2 and 4.3.