214 Chapter 8—Web Storage and Offline Web Applications
desired item is defined with the lowest level of the web server (/) and therefore
applies to all files on this server simultaneously. Instead of an inaccessible re-
source, we want to display the file menu.html.
Finally, the configuration file also contains the entry CACHE:, introducing another
section of content to be saved. In this example, the stylesheet style/innbar.css
could just as well be listed at the very top of the configuration file, and we could
omit the CACHE section altogether.
The specification describes an interesting special case in which the cache mani-
fest file contains the following:
CACHE MANIFEST
FALLBACK:
/ /offline.html
NETWORK:
*
With this trick, you can construct something like a complete offline cache of
HTML pages on a web server: Each file referencing the cache manifest is saved
locally when first loaded and only fetched from the server if the manifest chang-
es. The FALLBACK section redirects all queries about HTML pages not found in the
cache to the page /offline.html. The section NETWORK with the joker symbol (*) is
required to display the page correctly even if the browser is online.
8.2.2 Offline Status and Events
Via the application programming interface (API) for Offline Web applications,
web developers have the option of checking the status of the offline storage and
can change it manually if necessary. The status queries refer to the constant sta-
tus assigned to the object window.applicationCache. Its numeric content relates
to the meanings presented in Table 8.2.
Table 8.2 Meaning of constants for application cache status
Value Name Meaning
0 UNCACHED The page is not in the cache. This can be due to
the fact that the page is not meant to be saved
offline or has not yet been downloaded.
1 IDLE The browser has downloaded the latest version
of the offline storage.
2 CHECKING The browser is checking whether the cache
manifest has changed.