If you want to save some data that will be used only for this particular session, say that the user login, you need to use sessionStorage, but if your requirement is that you want to allow the user to open several tabs, then SessionStorage will not be because sessionStorage is not used in different tabs, for this you will need to use localStorage.
Be sure to keep the number of open and closed tabs and clear the local storage when the last tab is closed.
source share