1

我找不到任何人不想将所有 URL 都放在 NETWORK: 部分的情况:

网络: *

如果资源不在 CACHE: 部分中,也不在 NETWORK: 部分中,则不会加载该资源。但是如果资源不在 CACHE: 中,但在 NETWORK: 部分中,则至少在用户在线的情况下会加载它!

4

2 回答 2

3

NETWORK部分允许您仅将您信任的资源列入白名单。这是一种安全措施。因此,它对于纯在线应用程序也很有用,即不使用其他两个部分 ( CACHE, FALLBACK) 的应用程序。

引用MDN(截至 2012-10-28 CEST,由我强调):

应用程序缓存中的网络条目本质上是一个“在线白名单”——在 NETWORK 部分中指定的 URI 是从服务器而不是缓存加载的。这使浏览器的安全模型通过限制对已批准资源的访问来保护用户免受潜在的安全漏洞。

于 2012-10-27T22:51:27.500 回答
1

是的,你是对的。以下是我找到的完美答案:-

 A manifest can have three distinct sections: CACHE, NETWORK, and FALLBACK.

CACHE:
This is the default section for entries. Files listed under this header (or immediately     after the CACHE MANIFEST) will be explicitly cached after they're downloaded for the first time.
NETWORK:
Files listed under this section are white-listed resources that require a connection to the server. All requests to these resources bypass the cache, even if the user is offline. Wildcards may be used.
FALLBACK:
An optional section specifying fallback pages if a resource is inaccessible. The first URI is the resource, the second is the fallback. Both URIs must be relative and from the same origin as the manifest file. Wildcards may be used.
于 2011-12-05T09:24:04.863 回答