开发者

Add entire folder to HTML5 App Cache

Is it possible to add an entire folder of files to an HTML5 cache manifest file? I can't list all of the files开发者_如何学Go in the folder individually because the files in this folder will be dynamically changing (it is a folder of images).


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.


No, At present there is no way to fetch the content of a folder for cache. A wildcard * is allowed only in the online white list section.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜