使用 HTML5 应用程序缓存为 Firefox 缓存 OGG 文件但为 IE 缓存 MP3 的最佳方式?
当您在一个浏览器中使用了一组资源但在另一个浏览器中没有使用时,有人对如何最好地处理使用应用程序缓存有建议吗?
示例:Firefox 的 OGG 音频和 IE 的 MP3。我可以缓存这两种类型的文件,但音频很大,并且存储的文件数量是浏览器可以使用的文件数量的两倍。
我最好的想法是创建几个不同的清单。例如,加载所有浏览器通用的资源,然后加载 MP3 等的单独清单,并在 iframe 中加载一个页面,一旦我可以在客户端确定他们正在使用 IE,该页面就会调用此清单。但是,如果我发现他们使用的是 Firefox,我可以在 iframe 中加载另一个页面(带有附加的 OGG 清单)。
这可行还是有更优雅的解决方案?
Anyone have suggestions on how to best handle using App Cache when you have sets of assets used in one browser but not in another?
Example: OGG audio for Firefox and MP3 for IE. I can cache both types of files, but audio is huge and would store twice as many files as the browser can use.
My best thought is to create several different manifests. For example, one to load assets common to all browsers, and then a separate manifest for, say, MP3's, and load a page in an iframe that calls this manifest once I can determine on the client side that they're using IE. If however I find that they're using Firefox, I can load another page (with the attached OGG manifest) in the iframe.
Would this work or is there a more elegant solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
现在我只是使用像这样的 nginx 重写规则
大多数 Web 服务器都会让您定义类似的重写规则。这是一个不错的选择,因为它速度快并且不需要进一步安装任何软件。
这个人正在使用 PHP 检查哪个浏览器,但你可以使用任何框架来做到这一点,最好是某种框架像 Node 或普通 ruby Rack 一样快。
For now I'm just using a nginx rewrite rule like this
Most web servers will let you define similar rewrite rules. This is a good option because it's fast and doesn't require any further installation of software.
This guy is checking which browser using PHP, but you could do this using any framework, preferably something fast like Node or plain ruby Rack.