#bleedbytes-javascript

With local storage, web applications can store data locally within the user’s browser.If users want to store  data in HTML page using java script instead of using SQL, then we need a storage called “local storage” which is pre-defined in java script.

Local storage concept was introduced to replace cookies,because cookies got cleared if they exceeds 4KB whereas local storage is for long-term

hat is b

CONTENTS:
#1.What is Local Storage in java script?
#2.Local Storage
#3.Session Storage

What is Local Storage in java script?:

Local storage is a part of web page which is itself an HTML specification.There are two ways to store the data in HTML using java script.

1.Local Storage

2.Session Storage

Local Storage:

Local storage stores the data with no expiration, this is the one we are using because we want to keep our data on the webpage and to use when we need it.The data will available forever.

Example for Local storage:-

Create a web page to store the data entered by the user.

local storage

Retrieve the stored data.

local storage

Example for Session Storage:

This only saves the data for the particular session so if the user closes the tab and all their data will be gone. Mostly users does not prefer this storage.

ALSO READ  Best javascript chart library

Syntax:

local storage

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.