View video tutorial

HTML Web Storage


Web Storage allows data to be stored on users browser.

What is Web Storage?

using web storage feature we can store some information locally on the user's computer.

Like cookies, but faster and much better than cookies.

Cookies generally store very small amount of data and it sent data to server on every requent where as web storage features can store larger data than cookies and dont send data to the server.

Cookies are more safer than web storage, So we can use web storage where security is not a serious concern.

Types of Web Storage

There are two types of web storage that differ in scope and lifetime.

Local Storage

Local storage uses the localStorage object to store data on a permanent basis. Stored local data will be available later until it is removed or cleared.

Session Storage

Session Storage uses a sessionStorage object to store data on a temporary basis for a single browser window or tab. Data disappears at the end of the session, ie when the user closes that browser window or tab.