Recommendations

PageSpeed
YSlow

PageSpeed: Use an application cache

Overview

Enabling an application cache allows a web page to be used immediately, then updated in the background while the web page is displayed.

Note: This rule is experimental.

How does your site score on this recommendation?

What is the Application Cache?

The application cache allows you to specify which files should be cached by a user's browser. By caching specific files, you are making these files available to the user while they are offline.

How do I enable the Application Cache?

To enable the cache, you need to add a manifest attribute to your file's html tag. This attribute needs to be on every page that you want cached. Your browser immediately knows to cache a document if it has a manifest attribute on the html tag.

Below is an example of an added manifest attribute, specifying an application cache.

<html manifest="my.appcache">
  <head>
  </head>
  <body>
    <p>My html document</p>
  </body>
</html>

What is the structure of the manifest file?

The very first line of the manifest must be CACHE MANIFEST, and the following must specify files which should be cached on the particular page.

CACHE MANIFEST
about.html
src/example.js
css/style.css
images/sprite_map.png

This is a very basic structure for a cache manifest, and there are many more options which can be included in the manifest file.

Summary

Content
Low
Hard