HTML5 缓存清单文件本身不被缓存,并在每次资源加载时调用
我们有一个在 iPhone 上运行的 Web 应用程序。
清单文件正常,并且资源(html、css、js)已正确缓存。
页面位于主屏幕中。
问题是,当页面从缓存加载资源时,还会对服务器进行 GET 调用以读取缓存清单文件。
服务器配置为发送正确的标头(max-age=31536000; public 等...)并很好地缓存除缓存清单本身之外的所有其他文件。
这是正常行为吗?由于该调用,每个资源加载看起来都会有轻微的延迟。
您知道这些多个调用是否可以获得状态 304 或什至更好地避免吗?
We have a web app that runs on the iPhone.
The manifest file is ok, and the resources(html, css, js) are cached correctly.
The page sits in the home screen.
The trouble is, when the page loads a resource from the cache, there is as well a GET call to the server to read the Cache Manifest file.
The server is configured to send the correct header (max-age=31536000; public, etc...) and caches well all other files except the cache manifest itself.
Is this a normal behavior? It looks there is a slight lag, because of that call, for each resource load.
Any idea, if these multiple calls can get a status 304 or even better avoided?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该查看规范以了解详细信息,但定期检查清单文件的更新(每个会话,或每小时或......)并且不遵循 http-header-cache 指令是合乎逻辑的,但如果发生这种情况,那就不合逻辑了对缓存中文件的每个请求。
那么这实际上可能是您的代码或移动 Safari 中的错误?
规范提到支持 http 304 响应代码,因此确保发送可能确实是一个解决方案。
you should check the spec for details, but it would be logical for the manifest file to be regularly checked for updates (every session, or every hour or ...) and for it not to follow http-header-cache directives, but it would not be logical if that would happen on each and every request for a file in cache.
so this might actually be a bug in your code or in mobile safari?
the spec mentions support for a http 304 response code, so making sure that is send might indeed be a solution.