Different types of browser storage

From this slide show http://slides.html5rocks.com/#slide8 and from Chrome: View> Developer> Developer Tools> Storage tab,

I found out that there are at least 4 types of browser storage: Databases, local storage, session storage, cookies (are there any more?)

What are the differences? When should I use one over the other?

For example, if a site wants to save user settings, what storage method should the site indicate in the browser?

Thanks!

Matt

+4
source share
1 answer

All of them are stored on the browser side to provide autonomous / caching mechanisms for web applications / sites:

  • local storage : simple storage with a key, data is always stored as strings. The same data is available for all pages of the domain and remains constant even after closing the browser.
  • session storage : the same thing, but locally for one URL and one browser session (deleted when the browser was closed).
  • SQL Database (aka WebSQL): A repository in a local database that you can access using SQL queries ... seems to be out of date since IE and Firefox said they would not implement it.

You may also soon learn about IndexedDB (now supported in IE 10, FF, and Chrome), which is kind of local / sessionStorage, but which you can use to store javascripts instead of just strings.

+4
source

All Articles