When to use LocalStorage?
- We want to store data persistently.
- When we do not want to lose data if the tab or browser is closed.
- Want to store user activity and track user actions.
- Need not maintain sessions.
- Other tabs or windows can access the stored data, which can be shared with other tabs or windows with the same origin.
The browser provides local storage and session storage objects to work with. We use the objects to store and manage the data.
How to save data in session and local storage ?
SessionStorage and LocalStorage are the two most important ways to store data in the browser. SessionStorage is the temporary storage that web applications use to store data, whereas LocalStorage is the persistent storage that websites use to manage our data. These storages reside in the browser’s memory.
Apart from these storage browser also stores information in Cookies. A Cookie is just some textual information about website. Cookies help to make the browsing experience better. Cookies are website specific and hold the information of frequently visited websites
Table of Content
- Steps to open Session Storage and Local Storage
- Memory Capacity
- Features of Session Storage
- When to use Session Storage?
- Methods of Session Storage object
- Demonstrating Session Storage
- Features of Local Storage
- When to use LocalStorage?
- Methods of Local Storage object
- Demonstrating Local Storage Object
Contact Us