开发者

html 5 offline storage

开发者 https://www.devze.com 2023-03-10 20:00 出处:网络
Hi I have a question about html5 offline storage..When I have a site which is dynamicaly generated in php and I want make it accessible offline...I have a man开发者_开发知识库ifest file with all image

Hi I have a question about html5 offline storage..When I have a site which is dynamicaly generated in php and I want make it accessible offline...I have a man开发者_开发知识库ifest file with all images, js, css and so on, but should I include too URLs of proper sites? Or when I go on particular part of my site, it will automatically save html markup and when reloading it will choose the cached version? I have main template where I have linked the manifest file with all the cached stuff (for whole site), so every generated html document have the same manifest file linked in.. How is that working?


There are two different approaches you can take with including files in your cache manifest.

  1. If you want everything to be available immediately, you need to list all the urls in the cache manifest. All of those url's will be cached when the first page loads.
  2. If you want to lazy load pages into the cache, you only need to include the images, js, css, and other supplementary files. When you go to the first page with a cache manifest specified, it will cache that page and all the files listed in the manifest. Other html pages will not be cached until you actually visit them. If you went offline immediately, you would only have a single html file in the manifest.

For our site, we chose option 1, because we wanted all pages related to the current day's content to be available immediately.

0

精彩评论

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

关注公众号