You may notice a very strange bug in the pages you store under the application cache. None of them are updating, despite the web server providing an updated file and manifest. At the risk of sounding clichéd, this is not a bug; it is a feature!

The AppCache is designed to supersede all network activity for resources. Effectively, after a file is AppCached, it will always be served from the browser’s local copy. So how do you force the application cache to update?

When your page loads, listen for the AppCache updateready event, and when it fires, swap the new cache in:

if ('applicationCache' in window) {
 addEventListener('updateready', function() {
     applicationCache.swapCache();   }, false);

Get HTML5: Your visual blueprint™ for designing rich web pages and applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.