AppCache enables webpages to cache (or save) resources locally, including images, script libraries, style sheets, and so on. In addition, AppCache allows URLs to be served from cached content using standard Uniform Resource Identifier (URI) notation.
By using AppCache to save resources locally, you improve the performance of a webpage by reducing the number of requests made to the hosting server; you also enable offline access to cached resources.
To cache resources locally:
1.Create a manifest file that defines the resources you want to save.
2.Reference the manifest file in each webpage designed to use cached resources.
3.Setup text/cache-manifest MIME type for appcache.manifest
Creating a manifest file
The manifest file is a text file that defines the caching behavior for resources used by the webpage, as shown in the following example.
# Defines resources to be cached.
# Defines resources to be used if non-cached
# resources cannot be downloaded, for example
# when the browser is offline..
# Defines resources that will not be cached.
Declaring a manifest
To associate a manifest with a webpage, assign the name of the manifest file to the manifest attribute of the html element, as shown in the following example.
<title>A Web Page</title>
<link rel="stylesheet" href="stylesheet.css">
<p>Results go here: <span id="results">Unknown</span></p>