Skip to content

Instantly share code, notes, and snippets.

View verekia's full-sized avatar

Verekia verekia

View GitHub Profile
var webappCache = window.applicationCache;
webappCache.addEventListener("updateready", updateCache, false);
webappCache.update();
function updateCache() {
webappCache.swapCache();
alert("Une nouvelle version est disponible.\nVeuillez rafraîchir la page pour mettre à jour.");
}
switch (appCache.status) {
case appCache.UNCACHED: // UNCACHED == 0
return 'UNCACHED';
break;
case appCache.IDLE: // IDLE == 1
return 'IDLE';
break;
...
if (webappCache.status == window.applicationCache.UPDATEREADY)
interface ApplicationCache {
// update status
const unsigned short UNCACHED = 0;
const unsigned short IDLE = 1;
const unsigned short CHECKING = 2;
const unsigned short DOWNLOADING = 3;
const unsigned short UPDATEREADY = 4;
const unsigned short OBSOLETE = 5;
readonly attribute unsigned short status;
<link rel="apple-touch-startup-image" href="startup.png" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-touch-fullscreen" content="yes">
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon.png" />
<link rel="apple-touch-icon" href="apple-touch-icon.png"/>
Creating Application Cache with manifest http://localhost/le-chemin-vers-votre-manifest
Application Cache Checking event
Application Cache Downloading event
Application Cache Progress event (0 of 3)
... (1 of 3)
... (2 of 3)
... (3 of 3)
Application Cache Cached event