HTML and CSS Reference
In-Depth Information
Then the manifest file itself needs to be created. This is a text file that
begins with the words CACHE MANIFEST and then lists all the files in your
web application, one per line:
CACHE MANIFEST
offline-2-a.html
offline-2-b.html
offline-2.css
example-2.png
Note that it's not necessary to list the file where the reference to the
manifest appears, because the file that references the manifest is auto-
matically added to the cache; but doing so may save you headaches
later if you end up with a large application and you change the file from
which the manifest is referenced. Also, note that paths are relative to
the manifest file, not the file from which the manifest is referenced.
Manifests and MIME types
The file extension used here for the manifest file is .appcache. This is recom-
mended by the HTML5 spec. Initially, manifest files were given a .manifest ex-
tension, but it was found that Microsoft was already using this extension for
another purpose. To avoid collisions, the recommended file extension was
changed. But the file extension isn't as important to the browser as the MIME
type the server sends along with the file in the headers. The correct MIME type
for manifest files is text/cache-manifest. MIME types were discussed in chapter
4, when we looked at video.
Start SimpleHTTPServer again, and
access the new page. As before, the
browser requests two files from the
server:
"GET /offline-2-a.html HTTP/1.1" 200
"GET /offline-2.css HTTP/1.1" 200
But this time there's a difference in the
browser—it's asking for permission to
store files for offline use.
Search WWH ::




Custom Search