HTML and CSS Reference
In-Depth Information
If the local server is started up again
and the page reloaded, you can see the
effect of selecting and then deselecting
Work Offline in the menu.
This is perfectly reasonable behavior
from the browser if you think about
it—there are so many reasons the
server may not be contactable, that it
can't be tied to a single property in the
browser or the operating system, or
linked to a simple event.
Before you get too disappointed, there's an alternative approach that
relies on detecting the property that an offline application really cares
about: whether it can connect to the server. To understand this
approach, you need to learn about some further features of the manifest
file: sections introduced with the keywords FALLBACK or NETWORK . A NETWORK
section lists resources that will always be fetched from the network—
they won't be available when offline. The FALLBACK section lists replace-
ments for certain files or directories when the user's offline. Here's ch06/
offline-example/offline-3.appcache, which has a FALLBACK section:
example-3.png dust-puppy-3.png
Let's see what difference that makes in what files are requested when
the browser makes an initial request for offline-3-a.html:
"GET /offline-3-a.html HTTP/1.1" 200
"GET /offline-3.css HTTP/1.1" 200
"GET /offline-3.appcache HTTP/1.1" 200
"GET /offline-3-b.html HTTP/1.1" 200
"GET /dust-puppy-3.png HTTP/1.1" 200
"GET /offline-3.appcache HTTP/1.1" 200
Search WWH ::

Custom Search