[whatwg] Disable Offline ApplicationCache programmatically?
Ian Hickson
ian at hixie.ch
Sun Apr 11 21:45:30 PDT 2010
On Fri, 12 Feb 2010, Markus Joschko wrote:
>
> We have a CMS driven application that should be available offline as
> well. That is not just a couple of pages but a few hundred including
> resources like PDFs and images. Now some pages also have parts with
> dynamic data, which is only to be shown when online. But then it need to
> be accurate.
The appcache mechanism wasn't designed for this kind of application. It is
intended for applications with a single interactive page.
> So what I would need is the ability to fetch all pages listed in a
> manifest to the client. But they should NOT be served from the cache as
> long as the client is online.
Why not just make the pages fetch the data dynamically instead of having
potentially stale data hard-coded in the page?
You can also use the fallback mechanism to do this, just have the offline
version of the page be the fallback for the online version of the page.
> To optimize the pages for offline mode (hide login/search boxes etc),
> it would be helpful to have a header that tells the server when the
> resources are fetched to be displayed offline.
It's wrong to think of the appcache mechanism as an offline-only mode. The
intent is that the application gets cached locally and then used always,
whether the network is available, not available, or flaky.
It becomes especially clear that an online/offline approach doesn't really
work on the Web when you consider schenarios like the user loading the
page while online, then going out of wifi range, then using the page, then
going back into wifi range, and still using the page. Is that online or
offline? Should you show the search box or hide it?
> Finally, 3) would allow for optimization when only a single resource
> is updated on the server. With the given spec after a manifest update,
> all referenced pages are checked for update. If I had control over the
> applicationCache entries, I could expire just the one updated entry.
Regular HTTP caching semantics can be used here to minimise server
traffic. Each page will be checked, but only the modified ones need be
downloaded. In a future version we might have some sort of mechanism for
the server to push specific updates to the offline cache without having to
update the manifest.
> The current spec reads like it is targeting mainly use cases where
> only a small initial frame of resources is needed and otherwise
> javascript and databases are used to provide the offline behaviour.
Yes, that's indeed the case.
> However with relatively small changes it could serve other purposes as
> well.
It will probably be the case that we'll add more features for handling
such cases in the future, once we have more experience with the model as
designed today.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg
mailing list