Ramblings of a Madman

General Ramblings About all things JavaScript and Browser Developer Tools

The Application Cache is no longer a Douchebag

Mike Ratcliffe's avatarMike Ratcliffe | May 05, 2013

If you have ever used the application cache you will probably be familiar with how easy it is to break offline functionality and how difficult it is to work out why things are broken. With a large offline web app finding the source of problems can be an almost insurmountable task.

I guess that what I am saying is that the application cache is a douchebag. I completely understand that if there is an error in your application's manifest you probably don't want your users to be confronted with a bunch of error messages but something needs to be done.

Because displaying a bunch of errors about a broken cache manifest is probably undesirable we have decided to create a developer tool that lets you know if you have a problem with your manifest. The main problem we have is that the Toolbox is already becoming crowded and we are just getting started.

Firefox Developer Tools Toolbox

Firefox developer tools toolbox

In order to avoid cluttering the Toolbox we have used the Firefox Command Line. The command line is a place where we can add as many tools as we like without cluttering the interface. To open the Developer Toolbar press shift + f2 or select Developer Toolbar from the web developer menu.

The appcache commands are available in Firefox Nightly

To list available appcache commands type "help appcache" in the developer toolbar.

Output from the help appcache command

Output from the help appcache command

The currently available appcache commands are:

appcache clear clears all appcache entries.

appcache list [searchterm] lists all appcache entries containing an optional search term

Output from the appcache list command

Output from the appcache list command

appcache viewentry shows the about:cache-entry page for the current cache entry.

Note: appcache viewentry will not give you any information until bug 861866 is fixed.

appcache validate [URI] is by far the most useful of the appcache commands. If a URI is specified then the cache manifest for that page will be validated. As many of you know, there are a lot of things that could invalidate a manifest but this command will uncover most of them.

Output of the appcache validate command

Output of the appcache validate command

If you find any situations where an application cache is invalid and our tool does not pick up the problem then please let us know. In fact, if you have an idea for a new appcache command then please tell us.

Mike Ratcliffe

Written by Mike Ratcliffe who lives and works in England building useful things.