if('applicationCache' in window) {
// 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.
try { window.applicationCache.swapCache() } catch(err) { }
// Swap it in and reload the page to get the new modified files.
var reload = confirm('An update for the 360 Review is available. Apply update?');
if (reload) window.location.reload();
}
}, false);
}, false);
}
但是在Firefox中,当我更改.manifest文件时会弹出确认对话框,但实际更改的页面都没有更新。 这是我的.htaccess文件:
AddType text/cache-manifest .manifest
ExpiresActive On
ExpiresByType text/cache-manifest "access plus 0 seconds"
Header append Cache-Control "public, must-revalidate"
<Files cache.manifest>
Header set Cache-Control "no-cache"
</Files>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/cache-manifest "access plus 0 seconds"
</IfModule>
当然是.manifest文件(浓缩):
CACHE MANIFEST
# v 4.8
CACHE:
css/pages.css
index.html
我目前正在运行Firefox 28.非常感谢任何帮助。