CDN上的应用缓存清单? [英] App cache manifest on CDN?

查看:151
本文介绍了CDN上的应用缓存清单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读有关HTML5应用缓存清单的详细信息(特别是来自这篇优秀的文章)。我很好奇这个想法是否有用:

I'm reading through details on HTML5's app cache manifest (especially from this excellent article). I'm curious if this idea would work:

我们在子域内的CDN上托管所有静态资源(脚本,css,字体,图像)(例如cdn .example.com和app位于www.example.com)。是否可以在CDN上托管应用缓存清单?例如,

We host all of our static resources (scripts, css, fonts, images) on a CDN within a subdomain (e.g. cdn.example.com and app is on www.example.com). Is it possible to host the app cache manifest on the CDN as well? For example,

<!doctype html>
<html manifest="http://cdn.example.com/appcache.manifest">
...
<script src="http://cdn.example.com/foo.js"></script>
...
</html>

如果是,清单列表是否可以来自CDN根目录?例如,在清单中:

If yes, can the manifest listings be from the CDN root? For example, in the manifest:

CACHE MANIFEST
/foo.js

有没有人有这方面的经验和/或知道任何警告?

Does anyone have any experience with this and/or know of any caveats?

编辑: WHATWG规范的工作草案上写着离线应用程序缓存清单可以使用绝对路径甚至是绝对URL ,然后显示一个包含图像CDN URL的示例。

The working draft of the WHATWG spec it says "Offline application cache manifests can use absolute paths or even absolute URLs" and then shows an example with CDN URLs for images.

推荐答案

我用我的清单测试过(在实例中)

I tested with my manifest (in real example)

CACHE MANIFEST
# 2010-06-20:v1

iscroll.js
http://peach.blender.org/wp-content/uploads/big_big_buck_bunny.jpg

它适用于我...你可以用验证器检查你的清单 http://manifest-validator.com/

It works to me... You can check you manifest with validator http://manifest-validator.com/.

W3C on ly说文件(具有清单属性的HTML文件)必须与清单相同的原始来源,他们不会告诉资源的URL必须太...你应该仔细阅读(在这里)。我还在W3示例中找到了跨站点URL(在此处查看),这意味着它可以正常工作......

W3C only says the document (HTML file that have manifest attribute) must be same origin source with the manifest, they don't tell URL of resources must be too... You should read it carefully (at here). I also found the cross-site URL in W3 example (check here), that means it works correctly...

最后,不要尝试在CDN上放置文件,JUST PUT它在您的服务器和链接资源到CDN。清单文件必须与其主条目具有相同的来源,其中包括其HTML文件,浏览器检查清单文件以查看其HTML页面列表是否已更改,而不是检查HTML页面以查看它是否指向不同的清单文件。

Finally, DON'T TRY TO PUT MANIFEST FILES ON CDN, JUST PUT IT IN YOUR SERVER AND LINK RESOURCE TO CDN. Manifest files have to have the same origin as their master entries, which includes their HTML files, and the browser checks the manifest file to see if its list of HTML pages has changed, rather than checking your HTML page to see if it points to a different manifest file.

这篇关于CDN上的应用缓存清单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆