1

I have a web application that I thought would be well-suited to using the application cache, a utility for a board game I play.

I went through a tutorial in the application cache, and it worked well... a little too well.

Most of the scripts in my app are consolidated and minimized as part of my deployment process, with the sole exception being jQuery. For jQuery, I use the copy hosted by Google.

This caused problems when I loaded the page for a second time, after it had been cached, as jQuery wasn't cached and it wouldn't load it.

I made changed it so that jQuery would be integrated with the other minimized scripts, but I was still having the problem. I modified the manifest and as far as I can tell, Chrome downloaded the updated manifest, but didn't download any of the updated resources therein.

I even removed the manifest attribute from the HTML tag, but it still wouldn't refresh the page. I had to actually comment out /index.html from the manifest in order to get the page to refresh.

So it seems that updating the manifest doesn't do anything as long as you're still caching the same resources. Is there something I'm missing? Is there any in the manifest file to force downloading again if the cached items are older than a certain date?

Edited to add: I'm doing the testing on Chrome (stable).

Asmor
  • 5,043
  • 6
  • 32
  • 42
  • Want to mention that I've tried using a script to check for window.applicationCache.status and swapCache() if it's UPDATEREADY. Chrome is constantly stuck on status = 1 (cached). – Asmor Sep 12 '11 at 21:42
  • Are you setting any expires headers on your resource files? My guess would be the browser is populating the appcache from it's network cache, rather than loading things from the server again. – robertc Sep 12 '11 at 23:26
  • With the understanding that I didn't configure my web server (shared hosting), I just checked in Fiddler and there aren't any caching headers enabled. That said, the browser is caching things (sending if-modified-since and if-none-match headers on requests). Is it possible that the updated manifest might grab the "network cached" copies without checking if they're up-to-date? – Asmor Sep 13 '11 at 13:22

1 Answers1

0

I managed to get it working by explicitly setting cache headers on just the manifest file, to force the manifest file to not be cached. I added this to my .htaccess:

<Files ~ "\.mf">
    ExpiresActive On
    ExpiresDefault "access"
</Files>

Note that I'm using .mf as my file extension... If you're using .appcache, change mf to appcache.

Asmor
  • 5,043
  • 6
  • 32
  • 42