HTML5 appCache 清单引用目录的默认文档

发布于 2024-12-21 15:13:11 字数 666 浏览 3 评论 0原文

在我正在处理的整个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉薄对峙 2024-12-28 15:13:11

缓存根据 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文