Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?

How to Fix AppCache

There are two very simple tweaks we can make to radically improve the adoption of AppCache.

Don't Require a Special Header

Most web authors don't know how to supply a special header for a file, and requiring that the manifest be served as text/cache-manifest significantly reduces adoption.

While it's easy for us to imagine that it's trivial to do, most authors don't know how to supply the necessary header, which is also entirely unnecessary.

PROPOSAL: Remove the requirement that the cache manifest MUST be served as text/cache-manifest.

Support Offline-Capable, but Online-Updated Applications

It should be possible for web authors to take advantage of the browser's offline behavior without rearchitecting their site into an application.

The main reason this is difficult is that even when online, the current application cache requires that the current cached version of the master resource (index.html) be rendered.

This means that web sites that rely on being able to update their main page cannot be made to easily work offline without changing their main page into a shell that downloads additional content and uses local storage or the like to store their data.

Additionally, this has search indexing implications. As a result, most web sites cannot easily make their sites available offline without a conceptual rearchitecture.

PROPOSAL: Add a new section to the application cache. Resources in this section would be cached in the application cache, and loaded from the cache when the user agent is offline. When the user agent is online, these resources would always be requested from the server (with HTTP caching semantics in play of course). The master resource could be added to this section, and if it was added, the master resource itself would be requested from the server when the user agent was online, instead of loading it from the cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment