Cover by Mark Pilgrim

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

The Fine Art of Debugging, a.k.a. “Kill Me! Kill Me Now!”

I want to call out two important points here. The first is something you just read, but probably didn’t really sink in, so here it is again: if even a single resource listed in your cache manifest file fails to download properly, the entire process of caching your offline web application will fail. Your browser will fire the error event, but there will be no indication of what the actual problem was. This can make debugging offline web applications extremely frustrating.

The second important point is something that is not, technically speaking, an error, but it will look like a serious browser bug until you realize what’s going on. It has to do with exactly how your browser checks whether a cache manifest file has changed. This is a three-phase process. This is boring but important, so pay attention. Here’s the procedure:

  1. Via normal HTTP semantics, your browser will check whether the cache manifest has expired. Just like with any other file being served over HTTP, your web server will typically include metainformation about the file in the HTTP response headers. Some of these HTTP headers (Expires and Cache-Control) tell your browser how it is allowed to cache the file without ever asking the server whether it has changed. This kind of caching has nothing to do with offline web applications. It happens for pretty much every HTML page, stylesheet, script, image, or other resource on the Web.

  2. If the cache manifest has expired ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required