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: |
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.
Create a web page to store the data entered by the user.
Retrieve the stored data.
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.
Syntax: