HTML5 缓存清单:将所有远程资源列入白名单?
我正在制作一个包含博客的 iPhone 版桌面网站。该博客经常嵌入来自其他域的图像(显然,在这种情况下,图像 URL 始终以 http:// 开头),但由于我使用的是缓存清单,因此不会加载这些图像,因为它们未在清单文件。
我有一个网络:白名单部分,其中包含我的所有 AJAX 请求文件等。我什至将 flickr 农场域列入白名单,因为我们添加到博客的许多图像都来自我们的 flickr 页面。 flickr 图像显示得很好,但来自另一个域的任何其他“随机”图像热链接显示已损坏。
我尝试在 NETWORK: 部分添加这样一行:
http://
,但它似乎不喜欢 http:// 作为白名单。
有人对此有什么想法吗?
谢谢! 亚历克斯
I'm doing an iPhone version of a desktop site that includes a blog. The blog often embeds images from other domains (the image URLs always start with http:// in this case, obviously), but because I'm using cache-manifest, these images don't load because they aren't declared in the manifest file.
I have a NETWORK: whitelist section that has all of my AJAX request files, etc. I've even whitelisted the flickr farm domains because a lot of the images we add to the blog come from our flickr page. The flickr images show up just fine, but any other "random" image hotlinks from another domain show broken.
I tried adding a line like this:
http://
to the NETWORK: section, but it doesn't seem to like http:// as a whitelist.
Does anyone have any thoughts on this?
Thanks!
Alex
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想我有一个解决方法。如果您创建了一个简单的服务器端文件 (remoteResource.php),您可以像这样引用该文件,结果会怎样:
PHP(或您使用的任何服务器端语言)可以在远程资源中进行 cURL 并将其不加修改地发送到浏览器。然后,将该文件列入白名单。
我还没有测试过这个,因为我正在使用的环境没有安装 cURL(呃),但我不明白为什么它不能工作。
I think I've got a workaround. What if you created a simple server-side file (remoteResource.php) that you could reference like this:
The PHP (or whatever server side language you're using) could just cURL in the remote resource and send it unmodified to the browser. Then, whitelist that file.
I haven't tested this because the environment I'm working with doesn't have cURL installed (ugh) but I don't see why it can't work.
只需将“在线白名单通配符标志”添加到您的清单中即可:
这应该可以解决问题!更多信息位于 Whatwg 规范页面希望
这有帮助!
just add the "online whitelist wildcard flag" to your manifest:
that should do the trick! more info on the whatwg spec page
hope this helps!