Offline storage, html5 offline storage
I. Support Detection
If (window. applicationCache) {// the browser supports offline storage} else {// the browser does not support offline storage} support: IE9 and earlier versions do not support
2. manifest File
Iii. Status
- ApplicationCache. status
- 0 === not cached
- 1 === idle (the cache is in the latest status)
- 2 === checking
- 3 === downloading
- 4 === Update ready
- 5 === cache expiration
4. update: actively update the cache
// Update setInterval (function () {applicationCache. update () ;}, 5000) every 5 seconds );
5. Event updateready: when a new cache is available and the update is complete, the event progress event is triggered: when a new cache is in the process of downloading, this event will be continuously triggered.
- The event objects in progress include loaded and total. Loaded indicates the files already loaded. total indicates the total number of files to be updated.
Other events:
- Checking event: checking
- Downloading event: downloading
- Updatereadey event: update complete
- Obsolete event: cache expiration
- Cached event: idle, the cache is in the latest status
- Error Event: error
- Noupdate event: Check that the update is complete and no update is required.