(移动)Safari 加载资源,尽管有缓存清单

发布于 2024-10-26 18:15:55 字数 433 浏览 0 评论 0原文

我一直在开发一个使用离线缓存的网络应用程序,部分原因是为了减少使用时对服务器的调用次数。

我希望登录页面加载并缓存所有资源,这样登录后的所有页面都不必这样做。

我从服务器日志中注意到的是,尽管在加载登录页面时请求清单中的所有资源(图像、样式表、javascript 文件),但在用户登录后,并重定向到例如 /workspace/,Safari(桌面和移动设备)似乎再次请求 /workspace/ 中列出的样式表和 javascript 文件,导致 HTTP 304从服务器。

虽然提供 304 的负载很小,但我想知道是否有办法避免这些负载。我在 Chrome(开发通道)中测试了相同的代码,Chrome 仅在登录后再次请求缓存清单,仅此而已。

如有任何想法,将不胜感激!提前致谢!

I've been developing a web app that uses the offline cache, partly as a way to reduce the number of calls made to the server while in use.

I was hoping to have the login page load and cache all the resources such that all pages behind the login would not have to.

What I'm noticing from the server logs is that although all the resources (images, stylesheets, javascript files) in the manifest are requested when the login page loads, after the user has logged in, and redirected to, say, /workspace/, Safari (both desktop and mobile) seems to request the the stylesheets and javascript files listed in /workspace/ again, resulting in a HTTP 304 from the server.

While the load in serving a 304 is minimal, I'd like like to know if there was a way to avoid those. I tested the same code in Chrome (dev channel), and Chrome only requests the cache manifest again after login, and that's it.

Would appreciate any thoughts! Thanks in advance!

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

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

发布评论

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

评论(2

蓝梦月影 2024-11-02 18:15:55

我注意到在我的离线应用程序中,主机页面(其中带有清单标签的页面)也必须位于清单文件中(仅在 iPhone iOS 4.3 以来),这是为了支持在航空公司/离线模式下启动。
也许这也与您的问题有关。

我在 iOS 4.3 中遇到离线模式问题
(阅读本文以了解 4.3 问题的更多信息http://www.theregister。 co.uk/2011/03/15/apple_ios_throttles_web_apps_on_home_screen/)但是当我更新到 4.3.2 时它再次工作。

I have noticed in my offline app that the host page (the one with the manifest tag in it) must be in the manifest file as well (only in iPhone iOS since 4.3), this to support startup in airline / offline mode.
Perhaps this has something to do with your problem as well.

I had a problem with the offline mode in iOS 4.3
(read this for more insight in the 4.3 issue http://www.theregister.co.uk/2011/03/15/apple_ios_throttles_web_apps_on_home_screen/) however when I updated to 4.3.2 it worked again.

韵柒 2024-11-02 18:15:55

我在 iOS 4.3.3 中发现了一个有趣的情况。我有一个 HTML5 离线应用程序,可以在 iPad 上的 iOS 4.2 中运行。但我将 iPad 更新到 iOS 4.3.1,它无法再从主屏幕以离线模式运行。然而,当我看到“user593037”说它在 iOS 4.3.2 上运行时,我再次更新了我的 iPad,今天,它在 iOS 4.3.3 上运行。

最初我的离线应用程序仍然无法离线工作。所以我回到了最基本的离线网页,并使用“cache.manifest”作为它工作的清单文件名。因此,似乎在 iOS 4.3.3 上,只有当这是用于缓存清单的文件名时,离线缓存才会起作用。我什至尝试使用文件名cache2.manifest,但它无法离线运行。

您还可以将“apple-mobile-web-app-capable”设置为“yes”,全屏运行它。

I have found an interesting situation with iOS 4.3.3. I have an HTML5 offline app that worked in iOS 4.2 on iPad. But I updated my iPad to iOS 4.3.1, it can no longer run in offline mode from the Home Screen. However, when I saw that "user593037" say that it was working on iOS 4.3.2, I updated my iPad again and today, its at iOS 4.3.3.

Initially my offline app still did not work offline. So I went back to the MOST basic offline web page and I used "cache.manifest" as the manifest file name it worked. So, it seems that on iOS 4.3.3 the offline caching will only work if that is the file name used for the cache manifest. I even tried with a file name of cache2.manifest and it will fail to run offline.

And you can also run it full screen with the "apple-mobile-web-app-capable" set to "yes".

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