HTML5 AppCache:有人可以解释清单文件中 NETWORK 部分的用途吗?

HTML5 AppCache: Can somebody explain purpose of NETWORK section in manifest file?

我已经阅读了 html5rocks,mozilla 开发者文档。这些定义非常混乱。谁能用简单的术语解释一下?

我不确定为什么我们甚至需要应用缓存清单文件中的 NETWORK 部分。我认为这和在 CACHE 部分没有条目一样好。

网络Mozilla:

Files listed under the NETWORK: section header in the cache manifest file are white-listed resources that require a connection to the server. All requests to such resources bypass the cache, even if the user is offline. The wildcard character * can be used once. Most sites need *.

网络HTML5Rocks:

Files listed in this section may come from the network if they aren't in the cache, otherwise the network isn't used, even if the user is online. You can white-list specific URLs here, or simply "", which allows all URLs. Most sites need "".

NETWORK:需要 用户在线的资源。

来自http://www.html5rocks.com/en/tutorials/appcache/beginner/

NETWORK:

Files listed in this section may come from the network if they aren't in the cache, otherwise the network isn't used, even if the user is online. You can white-list specific URLs here, or simply "*", which allows all URLs. Most sites need "*".

一般做法是使用 CACHE 部分定义应缓存哪些资源,然后使用带有 * 通配符的 NETWORK 部分来默认所有其他资源以要求用户在线。

示例:

 CACHE:
 # These resources will be downloaded once to be cached  on the client.
 # After they are cached, even if the user has a network connection,
 # they will not re-download these resources, but instead use their local
 # cached copies instead.

 /favicon.ico
 /index.html
 /images/banner.html

 # This section will explicitly tell the client "every other resource"
 # requires a network connection.
 NETWORK:
 *

那么,为什么要明确告诉客户端所有其他资源都需要网络连接?

http://alistapart.com/article/application-cache-is-a-douchebag#section7 常见问题 #5 将对此进行解释。

If you cache index.html but not cat.jpg, that image will not display on index.html even if you’re online.

你可以在这里看到他们的演示:http://appcache-demo.s3-website-us-east-1.amazonaws.com/without-network/