I'm making an offline web app that looks like it'll be around 1.5MB.
Is there anyway to check that all of my offline files in the manifest were downloaded when the user bookmarked my app? Or better yet, a progress bar like it was a iTunes App download.
1.5MB will probably be safe, but lets say I made an offline web app that was 50MB and a user bookmarked the web app while on Wi-Fi on an iPad that doesn't have 3G service. They bookmarked it then immediately left the Wi-Fi zone, how would they (or I know) if all the files were cached/stored locally?
Use the appCache event listeners
function handleCacheEvent(e) {
// Do your thing
}
function handleCacheError(e) {
alert('Error: Cache failed to update!');
};
// Fired after the first cache of the manifest.
appCache.addEventListener('cached', handleCacheEvent, false);
// Checking for an update. Always the first event fired in the sequence.
appCache.addEventListener('checking', handleCacheEvent, false);
// An update was found. The browser is fetching resources.
appCache.addEventListener('downloading', handleCacheEvent, false);
// The manifest returns 404 or 410, the download failed,
// or the manifest changed while the download was in progress.
appCache.addEventListener('error', handleCacheError, false);
// Fired after the first download of the manifest.
appCache.addEventListener('noupdate', handleCacheEvent, false);
// Fired if the manifest file returns a 404 or 410.
// This results in the application cache being deleted.
appCache.addEventListener('obsolete', handleCacheEvent, false);
// Fired for each resource listed in the manifest as it is being fetched.
appCache.addEventListener('progress', handleCacheEvent, false);
// Fired when the manifest resources have been newly redownloaded.
appCache.addEventListener('updateready', handleCacheEvent, false);