1

I have a Webapp that uses the application cache for offline and online access. The problem I'm running into is that some of my users are not seeing updates when I change the manifest file. It works for me and for others, so my only theory is that some ISPs are caching the manifest file.

Has anyone else encountered this?

I don't know of any way to programmatically flush the browser application cache to force the update. window.applicationCache.update() does not seem to do the trick (at least on iPad). The usual trick of adding queryies to the URLs probably would defeat offline behavior.

In desperation I could simply use an unchanging loader page and put all the code in localStorage and do my own updates.

srkleiman
  • 607
  • 8
  • 16
  • What expiry headers are you sending with the manifest file? – robertc Oct 16 '11 at 00:30
  • Thanks! Would ExpiresByType text/cache-manifest "access plus 30 minutes" do the trick? What about the html, js, and images? Would this affect offline behavior? – srkleiman Oct 16 '11 at 08:29

1 Answers1

0

Normal practice is to expire the manifest file immediately, as per HTML5 Boilerplate:

ExpiresByType text/cache-manifest       "access plus 0 seconds"

Firefox in particular is known to have issues with caching the manifest file if it is not explicitly expired. The HTML5 Boilerplate file linked to above also has a load of sensible defaults for other file types.

robertc
  • 74,533
  • 18
  • 193
  • 177
  • Since I'm using the application cache and I don't currently have versioning, I'd like to make sure all intermediate caches are turned off for all the other file types (js, css, png) to get consistent images. Will 0 expiration times for the other types also affect the application cache if offline? Do I need versioning? – srkleiman Oct 16 '11 at 20:36
  • I don't have separate URLs or query strings for each version of each js, css, or image component. – srkleiman Oct 17 '11 at 05:12
  • @SteveKleiman Are you going to be updating all those things very often? It'll make little difference for the appcache, but usually you let people cache those files as long as possible. – robertc Oct 17 '11 at 07:43
  • I send out an update every few weeks. My main concern is that they get the update within a day, that the update contains the most recent version of the files, and that the application cache continues to work when offline. – srkleiman Oct 17 '11 at 16:03
  • If they're checking something every day (which they'd have to be to get the update within a day), then setting your expiry to a few days less than the few weeks between your updates should be fine. Or you can just make everything expire immediately, but this might increase your traffic from any users who choose not to allow offline storage, or any files which are accessed independently of the cache. – robertc Oct 17 '11 at 16:40