Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add entire folder to HTML5 App Cache

Tags:

html

offline

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).

like image 997
devongovett Avatar asked Aug 23 '10 17:08

devongovett


1 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.

like image 133
mattbasta Avatar answered Nov 11 '22 20:11

mattbasta