cache manifest Flashcards
Which software storage feature is introduced in HTML5? What is its purpose?
The cache manifest is introduced in HTML5 which is a software storage feature that provides the ability to access a web application even without a network connection.
What is the role of manifest file in cache manifest software storage feature?
A cache manifest file contains the sources that are required by a web application e.g. HTML pages, images, CSS, JS etc. On the very first user visit to a HTML site with cache manifest feature, his web browser will read the HTML5 manifest file, download the resources given and store them locally. In the absence of a network connection, his web browser will shift to the local copies and hence web application will be available to him even without a network connection.
Which content type must be served by the cache manifest file?
text/cache-manifest
Assume that you intend to use cache manifest feature and your web application exceeds on HTML page. Can all the pages share same manifest file?
Yes. Each web page must have a manifest attribute that points to the cache manifest. e.g. ‹!DOCTYPE HTML›
‹html manifest=”/cache.manifest”› ‹body›
‹/body› ‹/html›
Write an HTML page that refers to a cache manifest file called mymanifest.manifest.
‹!DOCTYPE HTML› ‹html manifest="mymanifest.manifest"› ‹head› ‹title›Hello‹/title› ‹script src="myjs.js"›‹/script› ‹link rel="mystylesheet" href="test.css"› ‹/head› ‹body› Hello World. ‹/body› ‹/html›
Should cache manifest files use absolute paths or absolute URLs?
Cache manifests can also use absolute paths or even absolute URLs as shown below:
CACHE MANIFEST
/js/myjs.js /main/css/mycss.css http://test/images/img1.jpg
How do you comment a line in cache manifest file?
Hash character (#) is used to comment a single line in cache manifest file. e.g. CACHE MANIFEST # this is a comment
How are spaces and blank lines handled in cache manifest file?
Spaces and blank lines are ignored in cache manifest file.
Name the cache manifest file headers.
Cache manifest file consists of 3 headers namely: a) CACHE (to cache the resources)
b) NETWORK (not to cache the resources)
c) FALLBACK (to substitute online resources that cannot be cached / were not cached)
Give an example of cache manifest file that uses manifest file headers.
CACHE MANIFEST
FALLBACK:
/ /offlinepage.html NETWORK: /rates.html CACHE:
/css.css /js.js /image.png
Review the given cache manifest file. What does a single character (/) before ‘offlinepage.html’ refer to? CACHE MANIFEST FALLBACK: / /offlinepage.html NETWORK: .....
The fallback section consists of a single line. i.e. / /offlinepage.html. The single character (/) before ‘offlinepage’ will match any URL pattern on your site. If the browser does not find the page in the appcache, the application will display the page /offlinepage.html.
If you have a cache manifest file that has no section headers, how will the resources be treated?
All manifest files are divided into three parts: the “explicit” section, the “fallback” section, and the “online whitelist” section. Each section has a header, on its own line. If the manifest file doesn’t have any section headers, by default all the listed resources are in the “explicit” section, hence they will be downloaded and cached locally.
If your browser has visited the web page (cache manifest enabled) before and recognizes the manifest file, will all the resources mentioned in the manifest be downloaded again?
If the manifest file has not changed, the downloading of resources will not occur.