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.
CACHE MANIFEST
CACHE:
# Defines resources to be cached.
script/library.js
css/stylesheet.css
images/figure1.png
FALLBACK:
# Defines resources to be used if non-cached
# resources cannot be downloaded, for example
# when the browser is offline..
photos/ figure2.png
NETWORK:
# Defines resources that will not be cached.
figure3.png
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.
<!doctype html>
<html manifest="appcache.manifest">
<head>
<title>A Web Page</title>
<script src="library.js"></script>
<link rel="stylesheet" href="stylesheet.css">
</head>
<body onload="doSomething();">
<p>Results go here: <span id="results">Unknown</span></p>
</body>
</html>
See more
https://msdn.microsoft.com/en-us/library/hh673545(v=vs.85).aspx
Article ID: 1710, Created: June 18, 2015 at 8:13 AM, Modified: June 18, 2015 at 8:13 AM