Is AppCache = Application Cache = Web Storage's LocalStorage?

拟墨画扇 提交于 2019-11-29 00:53:57

问题


I'm getting a bit confused by the (varied) terminology for HTML5 offline storage.

I think that AppCache is another name for Web Storage and you specify what will be stored offline via the Cache Manifest. And there are two types: LocalStorage (persists beyond the current session) and session storage (which does not persist beyond the current session).

The above is what I'm reading from W3C and from wikipedia but Head First HTML5 Programming (Freeman & Robinson) describes LocalStorage in depth, then has Web Storage (with info on Cache Manifest) in the appendix ("things we aren't covering).

Am I understanding this correctly?


回答1:


WebStorage is the possibility in HTML5 to store data on client side (think of it like cookies, but with usually 5 MB available space). The're two ways to store that data (scope):

  1. Just for a session until the browser get closed (SessionStorage)
  2. For a longtime period even if the browser get closed and the host's shutdown

http://diveintohtml5.info/storage.html


AppCache is the HTML5-ability to store the whole web-app (pages, images, css, JavaScript) in the browser to make it available even if the client has no internet connection at all.

http://appcache.offline.technology/





回答2:


LocalStorage:

  1. LocalStorage is used to save intermediate data in client side without using cookies.
  2. Saves data in the form of key-value pairs
  3. Saved data persists in the browser until it is explicitly removed. If not removed, it will be available for years.
  4. Memory 5Mb

AppCache:

  1. HTML5 applications offers offline application feature by saving html page and related files(css, js..) locally in appCache. These files will be used to render page when network connection is not available. Application will have manifest file containing list of files to be dowloaded to render offline application feature. If there is a change in manifest file(any file is added/removed from application), then new set of files will be downloaded. Old file will be replaced by new the ones once reload is clicked.
  2. Saves files as data - html, js, css,etc
  3. Saved data will be available until reload is clicked or until browser is closed.
  4. Memory varies based on browser. See http://grinninggecko.com/2011/02/24/developing-cross-platform-html5-offline-app-1/


来源:https://stackoverflow.com/questions/10986026/is-appcache-application-cache-web-storages-localstorage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!