HTML5 cache manifest: what exactly does it do? the documentation is unclear
It's not clear to me from the descriptions of the cache manifest that I've read (e.g. http://www.w3.org/TR/offline-webapps/#offline and elsewhere) what this file does. I'll explain what I find to be unclear.
The heading name ("Offline Web Applications") suggests that the cache manifest is relevant only for offline scenarios; the cache manifest is defined as
"The mechanism for ensuring Web applications are available
even when the user is not connected to their network"
But does the cache-manifest have any implications for online use? It seems so. The file contains a NETWORK section, and the files listed there (sometimes I'v开发者_Python百科e seen it described as the last file listed there) do not go into the cache; they
"...should never be cached, so that any attempt to access that file will bypass the cache."
What would "bypass the cache" mean in an offline context? But if the user is online, are files listed in the NETWORK section always obtained from the server, even if they had been previously cached?
The files added to the NETWORK section are said to be "white-listed". Normally, to whitelist something means to allow it. Actually, these files are being black-listed -- i.e. not allowed into the cache.
This page is being copied verbatim or paraphrased lemming-like in many other documents, so the original's imperfect clarity is being perpetuated.
So, my question: could someone please provide an authoritative, clear, and concise definition of the purposes the cache-manifest serves, giving examples of how one would set cache-expiration policies, such as expiring content at midnight on December 31, 2010. Is future-expiration even possible to do, declaratively, in HTML5?
Thanks
Files listed for caching in the manifest will always be served from the application cache, whether you're online or offline. The browser will always look first in the application cache for any resource requested from a page covered by the manifest, hence the terminology "bypass the cache". The network whitelist can then be seen as a set of files for which the browser will skip the step where it checks the application cache for the resource.
The only way to expire items in the application cache is to change your manifest file. Future expiration of files in the application cache is not possible, you will always be dependent on the user connecting to your website after you've updated your manifest file.
精彩评论