[html5] Offline apps

Jukka K. Korpela jukka.k.korpela at kolumbus.fi
Sat Apr 9 23:03:10 PDT 2011

Ilkka Huotari wrote:

> To summarize my ideas/problems so far:
> - I would like to load certain pages from the web server when I'm
> online (i.e. not from the cache).
> - If I'm offline, I would like to load these same pages from the
> cache.

That's more or less what happens normally, though subject to caching 
conditions. The best approach to control such issues is via normal cache 
control, see http://www.mnot.net/cache_docs/

> - Not sure if the above is supposed to be possible with the appcache
> mechanism.

No, the appcache mechanism is supposed to make an application work as if the 
user were offline, except that when he is actually online, the browser 
checks for the _cache manifest_ only (and if its contents has changed, the 
application cache is refreshed). It bypasses normal cache control, freshness 
information etc.

> Problems:
> - Pages are shown from the cache to user even when the user is online.

So this works as defined.

> This seems a bit unnecessary, especially if I have defined
> "Cache-Control: no-cache" for the said pages.

It's part of the idea of application cache. I wonder how useful the idea 
is... but in any case, it's not useful as a general replacement for normal 

I wonder why you wish to defeat normal caching when the user is online, yet 
consider using an application cache. Preventing all caching of a resource 
normally makes sense only if the contents is automatically generated with 
unique data or updated by some automated process(es)  or otherwise very 
frequently (say, a news page), or something like that.

> - Pages are cached/shown from the cache even if I put them into
> network section. I really don't understand why, is this a bug in
> browsers?

Could be a bug. In my tests, application cache manifests haven't worked that 
perfectly, though in my early experiments, some oddities were caused by my 
mistakes. Browser tools for inspecting application caches seem incomplete - 
at some point, it seemed to be possible to see what happens, in Resources > 
Application Cache in debug mode in Google Chrome (the one you enter by 
right-clicking and selecting Inspect Element), but now it appears to be 

> Also, the manifest file change isn't really solving these problems,
> imo, because it means that multiple page page loads are needed until
> the change is shown.

By the current definition of application cache, changing the manifest 
contents (changing last write is enough - it's really a matter of contents 
matching, which is rather odd design, if you ask me) is the way to force 
browsers (when online) to refresh the application cache.

Yucca, http://www.cs.tut.fi/~jkorpela/ 

More information about the Help mailing list