The Application Cache has two main use cases:
- Offline Pages – The Application Cache is designed to support offline web content so that when the browser has no internet connection the content can still be viewed. As stated in the
In order to enable users to continue interacting with Web applications and documents even when their network connection is unavailable — for instance, because they are traveling outside of their ISP’s coverage area — authors can provide a manifest which lists the files that are needed for the Web application to work offline and which causes the user’s browser to keep a copy of the files for use offline.
- Better Caching – Mobile browsers typically have a small cache as shown in the table below. An average mobile page size is 549KB, therefore the Browser Cache would be fully
cycled after 8 page hits. The Application Cache provides additional control over resources stored in the cache. The Application Cache is a separate cache to the Browser Cache and therefore it is not subject to the same size restrictions.
Note: These figures are slightly out of date but I’m currently working on an automated test to recalculate them and compare them against Application Cache size. Ideally I’ll upload this automated test to BrowserScope.
- Security – The manifest file, which controls the Application Cache, can be used to limit which resources are downloaded for a page. If the manifest file is “closed” (as described in the next blog article How to use the Application Cache?) then only those resources listed in the manifest file are downloaded. Any other resource can not be downloaded as part of any page the manifest file is attached to.
- Faster Web Pages – When a site that is already in the Application Cache is viewed, the browser displays the site immediately without waiting to download any resources.
- Lower Network Bandwidth – When a site that is already in the Application Cache is viewed, the browser displays the site immediately reducing network bandwidth. The only resource that is downloaded when the site is viewed is the manifest file, which describes what should be cached (see How to use the Application Cache?). This file is downloaded so that the browser can check whether the contents of the Application Cache is still “fresh” i.e. it is still valid.
- Lower Web Server Load – When a site that is already in the Application Cache is viewed, the browser displays the site without any requests going to the Web Server except for the manifest file request. This reduces load on the Web Server and allows the web site to better at handling a spike in users because not all the additional site usage will result in additional requests arriving at the Web Server.
Although I have described several advantages there are also many disadvantages with using the Application Cache. In fact many people find using the Application Cache too complex and problematic. In a future blog article called Problems with Application Cache I will describe the problems with the Application Cache. In a future blog article called Tips for using Application Cache? I will describe tips and general rules to avoid many of the problems associated with using the Application Cache.