开发者

Does HTML 5 application cache have any benefit for online apps?

Does the HTML 5 application (offli开发者_JS百科ne) cache have any benefit for online/connected apps?

My page needs to be online to function and is loaded exclusively in a UIWebView as part of an iOS app. This page is loading some large dependencies and I was wondering if I could use the HTML 5 app cache to store these dependencies to avoid relying on the regular browser cache.

So I guess my question is:

When an HTML 5 page is online, does it use the offline cache if a dependency already exists in the HTML5 offline cache?


Yes, the HTML5 offline application caching works with online applications, allowing you to benefit from indefinite local caching. For example, see http://www.w3.org/TR/html5/offline.html#concept-appcache-onlinewhitelist about the ability to specifically whitelist particular URLs which do not get cached.


Offline web apps make use of a cache manifest as you probably know. Any resources declared in the CACHE: section of this file will be stored in the offline cache, and so a user agent that can work with such things will always pull the resources from there—theoretically therefore, there is a performance benefit.

Conversely, any pages / resources specifically listed in the NETWORK: section of your cache manifest will not get cached locally (throwing errors when offline), and the app will require a connection to load them.

The benefits of using an off-line cache have to be weighed against the additional maintenance you may incur in providing (and updating) the manifest cache file itself, but hey.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜