Today want to optimize the next project, try the next HTML5 AppCache, found still a bit of pit, and finally give up temporarily. Here are the two pits below.
1. AppCache also caches files that reference AppCache in addition to the files that are cached in the list. Like index.php, citing AppCache.
<manifest= "Demo.appcache"></html>
Index.php will also be cached, and if there is any dynamic data in the index.php, the data will not be updated.
If you want to avoid this problem, then the content of the homepage must not be dynamic content, such as to change the index.php to index.html, and then use AJAX to request data to do the display. This requires some modification of the already written program.
2. AppCache Update cache is the version number in the comments in the AppCache file, if the version number is updated, the browser will download all the files that need to be cached, so that there will be multiple download requests at the same time, which sometimes does not meet the expectations.
Through the above two points, found that HTML5 some standards have yet to be strengthened and developed, at least appcache this feature is not as good as imagined. If you need to use it, make sure two points:
1. The homepage cannot be dynamic content
2. Ensure that the resources are not constantly changed, and then write into the AppCache, otherwise the cost of the update is relatively large.
HTML5 AppCache Trial Summary