移动网络应用程序中的 HTML5 离线问题

发布于 2024-11-26 06:43:42 字数 682 浏览 3 评论 0原文

我无法在 iPhone Mobile Safari 中使用离线模式。

我已将缓存清单文件包含在目录的根目录中。

 <html lang="se" manifest="cache.manifest">

我的cache.manifest看起来像

  CACHE MANIFEST 

  CACHE:
  /images/background-iphonelines.png
  /images/acne.jpg
 /images/lisa.jpg
 /images/bruno.jpg
 /images/urban.jpg
 /shops/acne.html
 /shops/lisa.html
 /shops/bruno.html
 /shops/urban.html
 /shops/shops.css
  /style.css
  script.js
  guide.html

  NETWORK:
  *

我还在我的根目录中包含了一个.htaccess文件,其中包含内容

  AddType text/cache-manifest .manifest

当我尝试在Iphone上打开我的应用程序时,它仍然显示“无法打开页面”(或类似的内容,将我的页面放在瑞典)。

有人对我做错了什么有什么建议吗?

I can't get offline mode in iphone mobile Safari to work.

I have included my cache manifest file in the root of my directory.

 <html lang="se" manifest="cache.manifest">

My cache.manifest looks like

  CACHE MANIFEST 

  CACHE:
  /images/background-iphonelines.png
  /images/acne.jpg
 /images/lisa.jpg
 /images/bruno.jpg
 /images/urban.jpg
 /shops/acne.html
 /shops/lisa.html
 /shops/bruno.html
 /shops/urban.html
 /shops/shops.css
  /style.css
  script.js
  guide.html

  NETWORK:
  *

I also included a .htaccess file in my root directory with the content

  AddType text/cache-manifest .manifest

When I'm trying to open my app on my Iphone it still says "Can't open page" (or similar, have my page in swedish).

Does someone have any suggestions what I'm doing wrong?

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

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

发布评论

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

评论(4

野鹿林 2024-12-03 06:43:42

您的标记和缓存文件看起来不错,但如果站点不会离线,则说明缓存有问题。它只要在一个要素上失败,整个事情就无法进行。您是否尝试过调试缓存文件?这篇文章将有所帮助:

Jonathan Stark,调试 HTML 5 离线应用程序缓存

注意这不会告诉您哪个资产导致失败(如果有),但它告诉您缓存是否正在工作或不是。

Your mark-up and cache file look fine, but if the site won't go off-line there's a problem with the cache. It only has to fail on one element, and the whole thing won't work. Have you tried debugging your cache file? This post will help:

Jonathan Stark, Debugging HTML 5 Offline Application Cache

Note this won't tell you which asset causes the failure (if any), but it will tell you if your cache is working or not.

云醉月微眠 2024-12-03 06:43:42

其实我昨天也遇到了类似的问题。尝试删除 CACHE: 并仅列出缓存的项目。我偶然发现了这个,现在它似乎可以在 IOS 上运行了。另外,我在顶部添加了一个注释字段,以确保我可以使缓存失效。我会尝试一下。

I actually had a similar issue yesterday. Try removing the CACHE: and just listing the items for the cache. I found this by accident and it seems to now work on IOS for me. Also, I added a comment field at the top to make sure I can invalidate the cache. I would give that a try.

腹黑女流氓 2024-12-03 06:43:42

我也有同样的问题。我将以下几行包含在 cache.manifest 文件中 &它为我修好了。

NETWORK:

*

I also had the same problem. I included the lines below in the cache.manifest file & it fixed for me.

NETWORK:

*
メ斷腸人バ 2024-12-03 06:43:42

我为此奋斗了两个小时,终于成功了!万岁!我已将“/”添加到缓存中,这就是问题所在......

I was struggling for 2 hours with this and finally I've managed it! HORAY! I've added "/" to cache, this was the problem...

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