sessionStorage automatically clears the data after closing window or tab.
Does sessionStorage clear on browser close?
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. Whenever a document is loaded in a particular tab in the browser, a unique page session gets created and assigned to that particular tab.
Does session storage work across tabs?
Right, sessionStorage is not shared across tabs. The way I solved it is by using localStorage events. When a user opens a new tab, we first ask any other tab that is opened if he already have the sessionStorage for us.