appcache checking update

<!DOCTYPE html>

<html manifest="a.appcache">

<head>

    <title></title>

</head>

<body>

1aaaa

<script>

    function onAppCacheReady() {

        appCache.swapCache();

        localStorage.clear();

        window.location.reload();

    }

    function onAppCacheIdle() {

    }

    var appCache = window.applicationCache;





    if (appCache.status == appCache.UPDATEREADY) {//have update



        onAppCacheReady();

    }

    else if (appCache.status == appCache.CHECKING || appCache.status == appCache.DOWNLOADING) {

        appCache.onupdateready = onAppCacheReady;

        appCache.onnoupdate = appCache.onobsolete = function () {

            onAppCacheIdle();

        };

    }





</script>

</body>

</html>

a.appcache:

CACHE MANIFEST

# 9891a09e51adaasdasd

asd.html





FALLBACK:





NETWORK:

*

  

When the a.appcache file is changed,then appCache.status will be changed; 

你可能感兴趣的:(update)