HTML5 appCache 清单引用目录的默认文档
在我正在处理的整个 jQuery 移动网站中,我有锚标记以以下方式引用 url:
- “/directory/”
- “/directory/subdirectory/”
当然引用:
- “/directory/index.html”
- “/ directory/subdirectory/index.html”
那么在我的清单文件中我是否需要引用“root”版本?例如
CACHE MANIFEST
CACHE:
/directory/
/directory/index.html
/directory/subdirectory/
/directory/subdirectory/index.html
NETWORK:
*
FALLBACK:
/ /offline.html
或者:
CACHE MANIFEST
CACHE:
/directory/index.html
/directory/subdirectory/index.html
NETWORK:
*
FALLBACK:
/ /offline.html
它是否自动知道“/directory/”相当于“/directory/index.html”等?好像不会。
Throughout a jQuery mobile site I am working on I have anchor tags that refer to urls in the following manner:
- "/directory/"
- "/directory/subdirectory/"
which are of course referencing:
- "/directory/index.html"
- "/directory/subdirectory/index.html"
So in my manifest file do I need to reference the "root" version at all? For example
CACHE MANIFEST
CACHE:
/directory/
/directory/index.html
/directory/subdirectory/
/directory/subdirectory/index.html
NETWORK:
*
FALLBACK:
/ /offline.html
or:
CACHE MANIFEST
CACHE:
/directory/index.html
/directory/subdirectory/index.html
NETWORK:
*
FALLBACK:
/ /offline.html
does it automatically know that "/directory/" is equivalent to "/directory/index.html", etc? seems like it wouldn't.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
缓存根据 URL 进行键控。浏览器在访问
/directory/
时获取的文件就是它为该 URL 缓存的文件。但是它不会自动知道/directory/index.html
等同于/directory/
,只有您的服务器才能知道这一点。如果您在清单中列出这两个 URL,则这两个 URL 将被缓存,即使它们是相同的。The cache is keyed according to URL. Whatever file the browser gets when it accesses
/directory/
is whatever file it will cache for that URL. However it doesn't know automatically that/directory/index.html
is equivalent to/directory/
, that is something only your server could know. If you list both URLs in the manifest then both URLs will be cached, even though they turn out to be identical.