为什么缓存清单在桌面上按预期工作时可能无法让移动 Safari 缓存站点?

发布于 2024-09-29 05:49:02 字数 183 浏览 4 评论 0原文

我正在本地玩一个简单的网络应用程序,但不太明白为什么它在 iPhone 上没有正确缓存。我正在提供具有正确 MIME 类型的 .manifest 文件,并且在桌面 Safari、Chrome 和 Firefox 上打开或关闭本地服务器时,该网站可以完美运行。只有移动版 Safari 无法缓存该网站。有什么想法可能是为什么吗?

I'm playing around with a simple web app locally, and can't quite figure out why it is not caching correctly on the iPhone. I am serving a .manifest file with the correct MIME-type, and the site works perfectly fine with my local server turned on or off on desktop Safari, Chrome and Firefox. It is only mobile Safari that is failing to cache the site. Any ideas why this might be?

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

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

发布评论

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

评论(3

挽清梦 2024-10-06 05:49:02

这似乎是 iOS 的一个错误。

我发现,如果您至少打开了一个 Web 视图并且清除了浏览器缓存,那么移动 Safari 总会遇到应用程序缓存错误。我认为清除浏览器缓存会破坏缓存数据库。所有对缓存数据库的访问都将失败。浏览器似乎仅在启动时创建此数据库。

要使应用程序缓存再次工作,请关闭所有 safari 视图,最后返回主屏幕来关闭浏览器。现在应用程序缓存应该可以工作了。某些移动设备还需要打开和关闭。

如果您知道检测这种情况的方法,请告诉我。

It seems to be an iOS bug.

I found out that mobile safari will always run into an application caching error if you have at least one web view opened and the you clear the browser cache. I think that clearing the browser cache will destroy the cache database. All accesses to the cache database will then fail. It seems that the browser creates this database only on startup.

To get the application cache working again close all safari views and finally close the browser by returning to the home screen. Now applicaton caching should working. Some mobile devices also requires switching on and off.

If you know a methode to detect this situation let me know it, please.

风为裳 2024-10-06 05:49:02

我遇到了类似的问题,但 Safari 和 iPhone 都无法工作,而 IE 和 Firefox 却可以工作。原因很复杂。其中之一是 HTML 标记中“manifest”一词的拼写错误。这是一个愚蠢的错误,令人非常沮丧的是 IE 和 FF 仍然可以离线工作。另一个问题是我使用default.asp作为我的应用程序的主页,并且没有将其包含在清单中。

我的应用程序是 mydomain.com/myapp/,因此浏览器从未看到“default.asp”。另外,根据 HTML5 规范,主页不需要在清单中,但显然 Safari 的看法略有不同......

I had a similar issue but Safari and iPhone were both NOT working whilst IE and Firefox were working. The reason was complex. One was a misspelling of the word "manifest" in the HTML tag. Silly mistake and very frustrating that IE and FF still worked offline. The other issue was that I was using default.asp as the main page of my app and not including this in the manifest.

My app was mydomain.com/myapp/ and thus the browser never saw the "default.asp". Also, according to the HTML5 spec, the main page need not be in the manifest but apparently Safari sees that a little differently...

野却迷人 2024-10-06 05:49:02

我可以确认运行 iOS 4.3 的 iPAD 上也存在该错误。

我花了相当多的时间让离线应用程序缓存在 iPad 上正常工作。我可以确认上一篇文章中提到的解决方法有效。

I can confirm that the bug is also present on iPAD running iOS 4.3.

I spent quite some time to make the offline application cache work on iPad. I can confirm that the workaround mentioned in the previous post works.

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