【发布时间】:2017-07-11 02:40:20
【问题描述】:
我正在尝试清理 Web 应用程序中的缓存,因此,我删除了我的 css 并将此函数放入我的 all.js 存档中,位于 document.ready 下方:
// Check if a new cache is available on page load.
window.addEventListener('load', function(e) {
console.log("entered the function");
window.applicationCache.addEventListener('updateready', function(e) {
console.log("entered the function 2");
if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
// Browser downloaded a new app cache.
// Swap it in and reload the page to get the new hotness.
window.applicationCache.swapCache();
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);
问题是,它没有清理我的缓存,擦除我的 css 后它仍然显示旧的,并且 console.log("entered the function 2") 也没有打印。 有人可以帮忙吗? 非常感谢!
【问题讨论】: