[js] 离线应用
#检测离线状态
if (navigator.onLine) { console.log('online') } else { console.log('offline'); } window.addEventListener("offline", function(e) { console.log("offline1"); }) window.addEventListener("online", function(e) { console.log("online1"); })
#appcache
//html 头部设置 <html manifest = "example.appcache"> ... </html> function onUpdateReady() { console.log('found new version!'); } window.applicationCache.addEventListener('updateready', onUpdateReady); if (window.applicationCache.status === window.applicationCache.UPDATEREADY) { onUpdateReady(); }