0

약 1.5MB의 오프라인 웹 앱을 만들고 있습니다.iOS 오프라인 웹 앱 - 진행 표시 줄?

사용자가 내 앱을 북마크에 추가했을 때 매니페스트의 모든 오프라인 파일이 다운로드되었는지 확인하고 있습니까? 또는 더 나은 방법은 iTunes App 다운로드와 같은 진행률 표시 줄입니다.

1.5MB는 안전 할 수 있지만, 3G 서비스가없는 iPad의 Wi-Fi를 사용하는 동안 50MB 인 오프라인 웹 앱을 만들었고 사용자가 웹 앱을 북마크에 넣었다고 할 수 있습니다. Wi-Fi 영역을 북마크 한 다음 Wi-Fi 영역을 즉시 떠났습니다. 모든 파일이 로컬에 캐시되거나 저장된 경우 어떻게됩니까?

답변

2

를 사용하여 앱 캐시 이벤트 리스너

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);