Chris Bateman

Application Cache Doesn’t Fool Around

If you’re actively developing a site that’s going to use the HTML5 application cache – don’t actually add it until you’re ready to go. Because once the browser gets a hold of it, you have to edit the manifest file every time you make any change to a file referenced in it.

It’s not like regular file caching, where a hard refresh can get a new version of everything. Once you cache something in the manifest, you’re stuck with it until you update the manifest file. And even then, the browser checks for updates to the manifest after it’s already displayed what it has – so you have to refresh a second time to see the changes (that’s why some sites will pop up a message to let you know there’s a new version available).

So what if you’ve already added a manifest, and you want to get rid of it? If you simply remove the manifest link from your HTML, you won’t make much progress, because guess what? The page that references the manifest is always cached. So the browser won’t know that you’ve removed the manifest file. The trick is to delete or rename the manifest file, causing it to 404. With a missing manifest, the browser will clear everything out and you’re good to go again.

By the way, here’s a handy tip: in Google Chrome, you can see exactly what is currently cached by typing “about:appcache-internals” in the address bar.

Update: To work on iOS, you must name the manifest “cache.manifest.” Don’t ask me why.

Tell me what you think: @batemanchris