Is it possible to add an entire folder of files to an HTML5 cache manifest file? I can't list all of the files in the folder individually because the files in this folder will be dynamically changing (it is a folder of images).
3 Answers
If the folder is dynamically changing, then it should not be in the application manifest. If the folder changes, then there still needs to be some sort of link from the page to the files in the folder. The manifest should just list off those items.
For instance:
/images/
1.jpg
2.jpg
3.jpg
4.jpg
and the (simplified) HTML file:
<html manifest="http://foo.bar/cache-manifest">
<body>
<img src="images/2.jpg" />
<img src="images/4.jpg" />
Should have a manifest that looks like this:
CACHE MANIFEST
http://foo.bar/images/2.jpg
http://foo.bar/images/4.jpg
If you wanted to update the manifest file to include new items, you can simply add a URL parameter that changes when the contents of the folder (and the manifest) change:
<html manifest="http://foo.bar/cache-manifest?updated=8_23_2010_1_53_pm">
Whenever the manifest URL changes, it will be re-downloaded.
Comments
to include a folder you would do something like the following.... but before that... I would look into making a dynamic way to create your manifest file using a build number or md5 to see if the file itself has changed.
CACHE MANIFEST
CACHE:
/Content/bootstrap/bootstrap.min.css
/Content/jQuery/jquery-1.8.3.min.js
/Content/bootstrap/bootstrap.min.js
/Content/js
The last line there seems to me to served up from that folder any files used on the page; these files appear in the application cache.