Reputation: 2608
I am trying to build a web app for iphone, and I don't understand
how to cache all the files under the "images" directory ?
and I modify one file on the server like "brandDB.txt", how to make the cache manifest update this file, and this file only to avoid downloading everything again ?
Thanks
CACHE MANIFEST
# 20131104-1430
index.html
brandDB.txt
icon.png
splashiphone.png
touch-icon-iphone.png
css/style.css
images/shareicon.png
images/bourez.png
images/john.png
...
NETWORK:
*
FALLBACK:
Upvotes: 0
Views: 6676
Reputation: 218
I did a program to easily generate the cache manifest file with the complete list directly from the Windows explorer, if you need it : http://matthieu.com/cmfg/
Upvotes: 2
Reputation: 590
Well, What I'm going to say, unfortunately is as Jake Archibald Said: "Application cache is a douchebag !" (Good Article on how it works (not actually a douchebag))
http://alistapart.com/article/application-cache-is-a-douchebag
Basically, you could create a script to list all your files in your image directory and paste it inside a generated AppCache File.
Application cache will only update when its file's content is changed , you'll also need ensure that the file itself is not cached.
I think you'll be needing your clients to reload the page twice for them to actually see the updates. (You could however using javascript tell the user that the page has updated and they'll need to refresh)
Upvotes: 1
Reputation: 75717
how to cache all the files under the "images" directory ?
List them all in the manifest file (easiest to use a script to generate the list if it's a lot of files).
how to make the cache manifest update this file, and this file only to avoid downloading everything again
The browser will populate the app cache from its own cache if you've set the headers on each file to allow caching. If you want to version control the files without using HTTP headers, add a query string to the end of the file, eg. brandDB.txt?v=1
- be sure to update the reference in the application if you do that, however.
Upvotes: 1