With HTML5 it is easy to make an offline version of a web application, by creating a cache manifest file.
HTML5 introduces application cache, which means that a web application is cached, and accessible without an internet connection.
Application cache gives an application three advantages:
Internet Explorer 10, Firefox, Chrome, Safari and Opera support Application cache.
The example below shows an HTML document with a cache manifest (for offline browsing):
To enable application cache, include the manifest attribute in the document's <html> tag:
Every page with the manifest attribute specified will be cached when the user visits it. If the manifest attribute is not specified, the page will not be cached (unless the page is specified directly in the manifest file).
The recommended file extension for manifest files is: ".appcache"
A manifest file needs to be served with the correct MIME-type, which is "text/cache-manifest". Must be configured on the web server.
The manifest file is a simple text file, which tells the browser what to cache (and what to never cache).
The manifest file has three sections:
The first line, CACHE MANIFEST, is required:
The NETWORK section below specifies that the file "login.asp" should never be cached, and will not be available offline:
An asterisk can be used to indicate that all other resources/files require an internet connection:
The FALLBACK section below specifies that "offline.html" will be served in place of all files in the /html/ catalog, in case an internet connection cannot be established:
Note: The first URI is the resource, the second is the fallback.
Once an application is cached, it remains cached until one of the following happens:
Be careful with what you cache.
Once a file is cached, the browser will continue to show the cached version, even if you change the file on the server. To ensure the browser updates the cache, you need to change the manifest file.
Note: Browsers may have different size limits for cached data (some browsers have a 5MB limit per site).
The perfect solution for professionals who need to balance work, family, and career building.
More than 10 000 certificates already issued!
The HTML Certificate documents your knowledge of HTML.
The HTML5 Certificate documents your knowledge of advanced HTML5.
The CSS Certificate documents your knowledge of advanced CSS.
The jQuery Certificate documents your knowledge of jQuery.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
Your message has been sent to W3Schools.