尽管Chrome正确缓存了资产,但应用缓存无法正常运行

时间:2014-05-24 01:24:49

标签: html5 caching html5-appcache

如果我在在线Chrome控制台日志中加载页面:

Document was loaded from Application Cache with manifest http://app.x.com/cache.manifest app.x.com/ Application Cache Checking event app.x.com/ Application Cache Downloading event app.x.com/ Application Cache Progress event (0 of 7) http://app.x.com/public/img/logos/logo.png app.x.com/ Application Cache Progress event (1 of 7) http://app.x.com/public/img/backgrounds/crowd.png app.x.com/ Application Cache Progress event (2 of 7) http://app.x.com/public/img/icons/close@2x.png app.x.com/ Application Cache Progress event (3 of 7) http://app.x.com/public/js/third_party/zepto.js app.x.com/ Application Cache Progress event (4 of 7) http://app.x.com/public/css/compiled.css app.x.com/ Application Cache Progress event (5 of 7) http://app.x.com/public/js/compiled.js app.x.com/ Application Cache Progress event (6 of 7) http://app.x.com/ (index) Application Cache Progress event (7 of 7) (index) Application Cache UpdateReady event

对我来说这看起来很好吗?

chrome://appcache-internals显示:

chrome debug

然而,只要我拔下以太网上的插头并刷新,我就会在控制台中看到一个带有以下内容的非样式页面:

nostyles

作为参考,我的cache.manifest看起来像:

CACHE MANIFEST
# v52
CACHE:
public/js/third_party/zepto.js
public/js/compiled.js
public/css/compiled.css
public/img/logos/logo.png
public/img/backgrounds/crowd.png
public/img/icons/close@2x.png

NETWORK:
*

我的.htaccess

中有AddType text/cache-manifest .manifest

1 个答案:

答案 0 :(得分:2)

这是我的错。我在我的标题中使用了css / compiled.css?123。 ?123是一个不断变化的数字,用于在开发期间破坏缓存。应用程序缓存似乎将其视为一个单独的文件,因此我必须删除唯一ID或将其与应用程序缓存同步才能使其正常工作。