HTML5 应用程序缓存白名单问题 - 不会忽略项目

发布于 2024-08-24 03:34:09 字数 395 浏览 3 评论 0原文

我正在尝试使用 HTML5 应用程序缓存来加快 iPhone Web 应用程序上的某些操作。它非常适合存储图像、CSS 和 JS,但问题是它还尝试存储 HTML。我无法让它忽略 html 并停止将其存储在缓存中。根据我的阅读,我必须将我想要加载的文件和目录“列入白名单”。我尝试列出我想要显式缓存的文件,并尝试在“网络:”标题下添加一系列内容。我已经尝试过,

*
/
/*
http://mysite.com
http://mysite.com/
http://mysite.com/*

但似乎都不起作用。有没有办法通过 MIME 类型或其他方式忽略 HTML 文件?任何建议将不胜感激。

瑞安

P.S.当然,我的网站不是 mysite.com..我只是为了简单起见才使用它。

I'm trying to use HTML5 Application Cache to speed some things up on an iPhone webapp. It works great for storing images, css and JS, but the problem is that it also tries to store the HTML. I haven't been able to get it to ignore the html and stop storing it in the cache. From what I've read, I have to "whitelist" the files and directories that I want to load no matter what. I've tried listing the files I want cached explicitly, and I've tried adding a series of things under the "NETWORK:" heading. I've tried

*
/
/*
http://mysite.com
http://mysite.com/
http://mysite.com/*

None of them seem to work. Is there any way to ignore HTML files by MIME-Type or anything? Any advice would be appreciated.

Ryan

P.S. Of course, my site is not mysite.com..I just used that for simplicity.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

森林迷了鹿 2024-08-31 03:34:09

我通过不在每个页面中引用清单来避免这个问题,而是在每个页面中都有以下内容:

<iframe src="cache.htm"></iframe> - with styles to hide the iframe

在cache.htm 中我有:

<!DOCTYPE html>
<html manifest="cache.manifest">
<head>
<meta charset="UTF-8">
<title>Main Cache Resource</title>
</head>
<body></body>
</html>

I've avoided this problem by NOT referencing a manifest in each page, instead I have the following within each page :

<iframe src="cache.htm"></iframe> - with styles to hide the iframe

inside cache.htm I have :

<!DOCTYPE html>
<html manifest="cache.manifest">
<head>
<meta charset="UTF-8">
<title>Main Cache Resource</title>
</head>
<body></body>
</html>
凌乱心跳 2024-08-31 03:34:09

基于之前的测试 以及与 html5“生态系统”中的人们的讨论,每个指定清单的 html 页面也会自动缓存。

based on previous tests and discussions with people in the html5 "ecosystem", each html-page that specifies a manifest is automatically cached as well.

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