我正在制作一个离线的网络应用程序,看起来大概是1.5MB。
是否检查清单中的所有脱机文件都是在用户标记我的应用程序时下载的?或者更好的是,像它这样的进度条是iTunes应用程序下载。
1.5MB可能是安全的,但假设我制作了一个50 3G的离线web应用程序,用户在没有3G服务的iPad上在Wi上标记了这个web应用程序。他们将其书签,然后立即离开Wi区域,他们(或我知道),如果所有的文件是本地缓存/存储?
发布于 2013-08-24 22:55:54
使用appCache事件侦听器
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);https://stackoverflow.com/questions/18367328
复制相似问题