Features of Session Storage
- SessionStorage is used to store the session information of the user.
- A session is started when a user login or after visiting a web page.
- This session is said to be ended when the user signs out or closes the tab.
- Data persists if a page refreshes.
- This session storage data is automatically cleared by the browser when a session is ended.
- Data is stored in the form of key-value pairs.
- Each tab has its own session Storage. Other tabs or windows, even the same website or origin cannot access this data.
- Depending upon the browser, storage limit for a origin(domain + port + protocol) will be up to 5 MB on each tab.
Example: We visited a site A in Tab 1 , and the same site in Tab 2, each tab has it’s own session storage up to 5 Mb. Other web pages from the same origin can use this data in that session.
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