Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 934
Clay Nichols Avatar asked Jun 11 '12 19:06

Clay Nichols


People also ask

Is cache the same as localStorage?

A cache is just some data that we remember we got back from a particular request (or URL). Thankfully the browser has this wonderful and simple way to store data called localStorage. LocalStorage allows us to read and write key/value pairs to and from the browser's storage.

How does AppCache differ from browser cache?

AppCache is specifically designed to allow web apps (and web sites) to be made available offline, though the same speed benefits which the normal browser cache provides, when the user is online, are also provided by AppCache.

Is cache stored in local storage?

Caching refers to storing information locally to speed communication between a client such as a web browser and a server such as a web server. The cache can be located on the client side, the server side, or – as is often the case – both.

What is an AppCache file?

The Application Cache (or AppCache) allows a developer to specify which files the browser should cache and make available to offline users. Your app will load and work correctly, even if the user presses the refresh button while they're offline.


2 Answers

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/


like image 113
Marvin Emil Brach Avatar answered Oct 02 '22 19:10

Marvin Emil Brach


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/
like image 26
Kaviyarasi P Avatar answered Oct 02 '22 20:10

Kaviyarasi P