Session storage is only available when serving your page from the server - you will find that it does not work if you open the HTML page locally because the session is missing.
In the case of browsers that may not support session storage, you can test this feature:
if (window.sessionStorage) { ...
source share