web-applications - cache.manifest 第一次工作然后失败

标签 web-applications html

我正在尝试将 html 5 缓存添加到网络应用程序,没有什么太复杂的只是图像/css/js。

当我在编辑 cache.manifest 文件后加载页面时,我在 Chrome 8 中得到以下调试信息:

Creating Application Cache with manifest http://example.com/themes/zenmobile/cache.manifest
Application Cache Checking event
Application Cache Downloading event
Application Cache Progress event (0 of 26) http://example.com/themes/zenmobile/plugins/img/toolbar.png
Application Cache Progress event (1 of 26) http://example.com/themes/zenmobile/plugins/img/greenButton.png
Application Cache Progress event (2 of 26) http://example.com/themes/zenmobile/plugins/jqtouch.transitions.js
Application Cache Progress event (3 of 26) http://example.com/themes/zenmobile/plugins/img/back_button_clicked.png
Application Cache Progress event (4 of 26) http://example.com/themes/zenmobile/plugins/img/button.png
Application Cache Progress event (5 of 26) http://quizible.com/sites/all/modules/jquery_update/replace/jquery.min.js
Application Cache Progress event (6 of 26) http://example.com/themes/zenmobile/plugins/img/grayButton.png
Application Cache Progress event (7 of 26) http://example.com/themes/zenmobile/plugins/img/chevron_circle.png
Application Cache Progress event (8 of 26) http://example.com/themes/zenmobile/plugins/img/on_off.png
Application Cache Progress event (9 of 26) http://example.com/themes/zenmobile/plugins/jqtouch.js
Application Cache Progress event (10 of 26) http://example.com/themes/zenmobile/layout.css
Application Cache Progress event (11 of 26) http://example.com/themes/zenmobile/plugins/img/chevron.png
Application Cache Progress event (12 of 26) http://example.com/themes/zenmobile/plugins/img/rowhead.png
Application Cache Progress event (13 of 26) http://example.com/themes/zenmobile/zenmobile.css
Application Cache Progress event (14 of 26) http://example.com/themes/zenmobile/plugins/img/loading.gif
Application Cache Progress event (15 of 26) http://example.com/themes/zenmobile/plugins/img/redButton.png
Application Cache Progress event (16 of 26) http://example.com/themes/zenmobile/plugins/img/activeButton.png
Application Cache Progress event (17 of 26) http://example.com/themes/zenmobile/images/bg_body.png
Application Cache Progress event (18 of 26) http://example.com/themes/zenmobile/plugins/theme.css
Application Cache Progress event (19 of 26) http://example.com/themes/zenmobile/plugins/img/toggle.png
Application Cache Progress event (20 of 26) http://example.com/themes/zenmobile/plugins/img/whiteButton.png
Application Cache Progress event (21 of 26) http://example.com/themes/zenmobile/plugins/img/toggleOn.png
Application Cache Progress event (22 of 26) http://example.com/themes/zenmobile/plugins/jqtouch.css
Application Cache Progress event (23 of 26) http://example.com/themes/zenmobile/plugins/img/button_clicked.png
Application Cache Progress event (24 of 26) http://example.com/themes/zenmobile/plugins/img/back_button.png
Application Cache Progress event (25 of 26) http://example.com/themes/zenmobile/plugins/img/blueButton.png
Application Cache Progress event (26 of 26) 
Application Cache Cached event

当我再次刷新页面时,所有的 css/images/js 都无法加载并且控制台日志喷出:

Document was loaded from Application Cache with manifest http://example.com/themes/zenmobile/cache.manifest
Application Cache Checking event
Application Cache NoUpdate event

然后加载“加载资源失败”

除了这个输出,我还没有发现任何有用的东西来尝试修复这个问题。有人以前见过这个吗?

最佳答案

遇到了同样的问题。把它放在底部为我修复了它:

NETWORK:
*

为了解决大多数人在 list 更新方面遇到的问题,这种方法对我来说非常有效:

在 url 中为 list 文件和所有缓存资源附加版本号,并设置 list 的内容以引用该版本号。像这样:

<html manifest="path/to/cache.manifest?v=42">

CACHE MANIFEST
#rev ?v=42

/css/foo.css?v=42
/css/bar.css?v=42
/js/script.js?v=42

我已经为我们实现了自动化,所以在新部署中我只是将数字增加 1(在我阅读的设置文件中的某处)并且它在所有提到的文件中都会受到影响。每个浏览器请求不仅会检测 list 文件更改,还会导致重新加载(和缓存)提到的每个资源,从而更新整个应用程序。

关于web-applications - cache.manifest 第一次工作然后失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4369033/

相关文章:

javascript - KnockoutJS `with` 绑定(bind)和IE8

javascript - HTML 文本一直向右扩展

web-applications - Firefox Webapp(Open Web App)无法使用自签名证书

web-applications - TCL 作为服务器端编程语言

ssl - Cloudflare 和 Heroku 的 Multi-Tenancy SSL

java - 在 Tomcat 上运行 Web 应用程序项目时更改 Eclipse 打开的 URL

java - Jsoup 正在转义 iframe 的内容

javascript - EventEmitter <string> 的上下文 'this' 未分配给 Observable <string> 类型的 'this' 方法

java - 如何在 Android 中使用 Jsoup 访问 HTML 数据中具有不同 idname 的内部相同类名 div

html - 减少跨度中的行间距