8.2 Offline Web Applications 215
Value Name Meaning
3 DOWNLOADING After a changed cache manifest was found, the
browser downloads the new cache content.
4 UPDATEREADY The browser has downloaded all necessary con-
tent for the cache but is not yet using the new
cache.
5 OBSOLETE The cache is marked as obsolete if the cache
manifest file cannot be loaded. The browser
should then delete the cache.
To retrieve the current values of the constant, you just need to enter its name in
the browser console: window.applicationCache.status. This outputs the corre-
sponding numeric value, similar to Figure 8.2. To be able to control application
cache behavior, the browser triggers certain events, which can be retrieved in the
programming:
window.applicationCache.addEventListener("progress",
function(e) {
alert("New file downloaded");
}, false);
The progress event, for example, is fired for each newly loaded file. In that case, an
alert window appears for every downloaded file. Table 8.3 shows a list of all events.
Table 8.3 The events for “Offline Web applications”
Name Description
checking The browser is checking whether there is a new version of the
cache manifest.
noupdate There is no new cache manifest on the server.
downloading The browser is downloading a version of the files to be saved. The
event is also fired when the files are downloaded the first time.
progress The event is called for each file to be downloaded.
cached All elements for the cache have been downloaded.
updateready All elements for the cache have been redownloaded (the cache
manifest file was changed).
obsolete The cache manifest file could not be loaded.
error An error occurred on downloading the elements for the cache.
The error can occur for several reasons, for example, a faulty
entry in the cache manifest file.