Loading, please wait...

LocalStorage and SessionStorage in Web storage

What is LocalStorage and SessionStorage in Web storage also how to use this.

localStorage and SessionStorage, part of the web storage API,

are two great tools to save key/value pairs locally.

token is stored client-side, most commonly in local storage - but can be stored in session storage or a cookie as well.

Today we are going to simple example read and write

sessionStorage is similar to localStorage ; the difference is that while data in localStorage doesn't expire, data in sessionStorage is cleared when the page session ends.

It’s also supported in all modern browsers,

but with sessionStorage the data is persisted only until the window or tab is closed,

while with localStorage the data is persisted until the user manually clears the browser cache or until your web app clears the data.