使用清单还是只更新缓存?

时间:2017-02-21 15:12:01

标签: html5 caching

我正在阅读有关我的网站的缓存清理和更新的内容,我只是无法弄清楚下面使用清单或此功能的不同之处:

// Check if a new cache is available on page load.
window.addEventListener('load', function(e) {

  window.applicationCache.addEventListener('updateready', function(e) {
    if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
      // Browser downloaded a new app cache.
      if (confirm('A new version of this site is available. Load it?')) {
        window.location.reload();
      }
    } else {
      // Manifest didn't changed. Nothing new to server.
    }
  }, false);

}, false);

link:https://www.html5rocks.com/en/tutorials/appcache/beginner/

0 个答案:

没有答案