在线时缓存清单弄乱了我的应用程序
SO 的大师
我正在尝试使用 CACHE MANIFEST/HTML5。我的应用程序是 JS 重的并且基于 jquery/jquerymobile 构建。
这是我的清单的摘录,
CACHE MANIFEST
FALLBACK:
/
NETWORK:
*
CACHE:
/css/style.css
/js/jquery.js
但不知何故,该应用程序在第一次时不会加载文件,整个应用程序崩溃了。
- 难道是我的格式不对?
- 我不应该将 JS 加载到缓存中吗?
- 如果有任何内容不可用,我应该如何以不同的方式对待这个问题,以便始终首先检查网络,并且只加载缓存中可用的内容?
谢谢。
Gurus of SO
I am trying to play with CACHE MANIFEST/HTML5. My app is JS heavy and built on jquery/jquerymobile.
This is an excerpt of what my Manifest looks like
CACHE MANIFEST
FALLBACK:
/
NETWORK:
*
CACHE:
/css/style.css
/js/jquery.js
But somehow, the app doesn't load the files the first time itself and the entire app breaks down.
- Is my format wrong?
- Should I never load JS into the Cache?
- How should I treat this differently to always check the network first if anything isn't available and only load stuff available from the Cache?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我尝试了一个带有缓存清单的简单页面,它对我来说效果很好,所以我不太确定问题是什么。但是,
请参阅深入了解 HTML5 关于此内容的精彩章节,特别是“调试的艺术,又名“”杀了我!现在就杀了我!”这解释了清单的更新方式。
另外,我认为我们还没有解决您问题的实质,因为不清楚您所说的“应用程序本身不会第一次加载文件”是什么意思。哪些文件不加载?刷新后它们加载正常吗? ETC。
I tried a simple page with your cache manifest and it worked fine for me, so I'm not really sure what the problem is. But,
See Dive Into HTML5's excellent chapter on this, particularly the section "The fine art of debugging, a.k.a. “Kill me! Kill me now!”" which explains how the manifest updates.
Also I don't think we've gotten to the meat of your question, because it's unclear what you mean by "the app doesn't load the files the first time itself". Which files don't load? Do they load properly after a refresh? Etc.
我让它刷新缓存的唯一方法是使用提交号或时间戳重命名清单文件,并将缓存声明更改为
我将这部分作为我的构建的一部分。
The only way I got this to work to refresh a cache was to rename the manifest file with a commit number or timestamp, and change the cache declaration to
<html manifest='mymanifest382330.manifest'>
I made this part of my build.