caching - Why does HTML5 offline re-cache the entire manifest, and only when the manifest file changes? -
i have been reading chapter on offline in dive html5, , has left me questions.
it says
every time make change 1 of resources in offline web application, you’ll need change cache manifest file itself. can simple changing single character. easiest way i’ve found accomplish include comment line revision number. change revision number in comment, web server return newly changed cache manifest file, browser notice contents of file have changed, , kick off process re-download resources listed in manifest.
but let's take wikipedia example discussed in same article. whenever article edited, manifest file must changed reflect edit, , user has stored pages offline lose them because not explicitly mentioned in manifest. desirable behaviour? if yes, why not following:
- store files in offline cache until deleted explicitly, when manifest changes
- update files in cache when changed (e.g., when server not return 304 not modified)
if 1 behaviour described in above 2 points, options? use local storage or something?
first, check out appcachefacts.info gain better understanding of confusing spec.
appcache work in unexpected ways, jake archibald explains in blog post application cache douchebag.
in it, behaviour described above achieved doing iframe magic. got away adding static page appcache manifest , loading body content through ajax calls of non-cached fragment pages, based on external events onclick, , storing body data in websql database future (possibly offline) reference. this, in effect, had made offline app entirely javascript-based without page reloads.
in place of websql, may use html5 local storage may feel uneasy 5mb storage limit.
as whys, can speculate. think that:
- appcache not store files until explicitly deleted, appcache size remain modest. in wikipedia example, seems bad idea cache every visited page , never clear (possibly deleted!) pages.
- files in manifest not re-checked on every page reload because mean explosive growth of server requests. if manifest file contains 30 files, send out 30 requests on every page load. if performed asynchronous, unacceptable.
Comments
Post a Comment