What is window.localStorage

The option.js file Submit this page. Chrome extension example) contains the following code:

  if ( window.localStorage == null) {
   ...
 if ( window.localStorage.customMailtoUrl == null) {

What does it mean? What is window.localStorage ?

+6
source share
3 answers

localStorage / sessionStorage is part of the HTML5 API. In essence, this is what cookies are used for. But it is much better.

https://developer.mozilla.org/en/DOM/Storage

+11
source

From http://www.w3schools.com/html/html5_webstorage.asp :

"What is local HTML storage?

In local storage, web applications can store data locally in a user browser.

Prior to HTML5, application data must be stored in cookies included in each server request. Local storage is more secure, and large amounts of data can be stored locally without affecting website performance.

Unlike cookies, the storage limit is much larger (at least 5 MB), and information is never transmitted to the server.

Local storage is a domain. All pages from the same domain can store and access the same data. "

+2
source

localStorage is a property of the HTML5 API that allows web applications to store data locally in a user browser.

Prior to HTML5, application data must be stored in cookies included in each server request. localStorage is another property that has many advantages over cookies.

HTML local storage provides two objects for storing data on the client:

window.localStorage - stores data without expiration

window.sessionStorage - stores data for one session (data is lost when you close the browser tab)

localStorage:

  • LocalStorage data has no expiration date.
  • localStorage is more secure since it does not send anything to the server, everything happens on the client side, i.e. in the browser.
  • localStorage at the beginning means that two or more html pages, from one source, can store and access the same data stored in the localStorage object.
  • It can store much more data than cookies. The storage size varies for each browser, for example, the latest versions of chrome and firefox can store at least 5 MB of data.
0
source

Source: https://habr.com/ru/post/912671/


All Articles