HTML and CSS Reference
In-Depth Information
EXAM TIP
If you really want to change the file extension, you need to configure the web server so
that your chosen file extension is returned with a MIME type of text/cache-manifest.
The application cache manifest file must list each and every file and resource required to
be stored for offline use. When the browser parses the manifest attribute of the html element,
it downloads the manifest and stores it locally. It also ensures that it downloads all the files
listed in the manifest so that they are available offline. The manifest file contains three sec-
tions: CACHE , NETWORK , and FALLBACK . Each section might appear just once, multiple times
in the file, or not at all. Each serves a specific purpose in how application caching functions
when dealing with the resources in specific scenarios. A typical manifest file looks like this:
CACHE MANIFEST
# My Web Application Cache Manifest
# v.1.0.0.25
#
#Cache Section. All Cached items.
CACHE
/pages/page1.html
/pages/page2.html
#Required Network resources
NETWORK:
login.html
#Fallback items.
FALLBACK:
login.html fallback-login.html
The first line in a manifest file must be CACHE MANIFEST . The manifest file, as with any
code file, can have comment lines added to it for additional explanations, as denoted by the
# symbol. The CACHE section lists all the resources that must be cached offline. This must
include all CSS files, JPG files, video and audio files, and any other resource required for the
page to function correctly. If you omit an item from the manifest file, it won't be cached,
which can result in unexpected behavior when the application is run offline.
The NETWORK section declares any resources that must be available from the Internet.
These items can't be cached. Anything that the page requires from the Internet, such as
embedded third-party elements, must be listed here. If such a resource isn't listed here, the
browser won't know to check on the Internet for it when in offline mode. When the browser
is in offline mode, it doesn't attempt to go to the Internet for anything unless it's listed in the
NETWORK section.
The FALLBACK section enables you to provide fallback instructions to the browser in
the event that an item isn't available in the cache and the browser is in offline mode. In the
 
 
Search WWH ::




Custom Search