Methods of session storage object
sessionstorage.setItem(key,value); // Adds data in key-value pair
sessionstorage.getItem(key); // Gets the data for the given key
sessionStorage.removeItem(key); // Removes the (key, value) pair data for the given key
sessionstorage.key(index); // Gets the key based on the index position
sessionstorage.length; // Returns the length of the storage list.
sessionstorage.clear(); // Clears all the session storage
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