View on GitHub

reading-notes

Reading Notes about Markdown-Html-Css-JavaScript

local Storage for Web Applications

The read-only localStorage property allows you to access a Storage object for the Document’s origin; the stored data is saved across browser sessions.

localStorage is similar to sessionStorage, except that while data stored in localStorage has no expiration time, data stored in sessionStorage gets cleared when the page session ends — that is,

when the page is closed. (Data in a localStorage object created in a “private browsing” or “incognito” session is cleared when the last “private” tab is closed.) _____ ## What is localStorage in JavaScript? localStorage is a property that allows JavaScript sites and apps to save key/value pairs in a web browser with no expiration date. This means the data stored in the browser will persist even after the browser window is closed. ____

Where is localStorage stored?

In Google Chrome, web storage data is saved in an SQLite file in a subfolder in the user’s profile. _____

What is Window.localStorage?

The localStorage mechanism is available via the Window.localStorage property. Window.localStorage is part of the Window interface in JavaScript, which represents a window containing a DOM document. _____

How does it work?

To use localStorage in your web applications, there are five methods to choose from:

window.localStorage.setItem(‘user’, JSON.stringify(person)); ```