Session storage

Session duration

Demonstration of the sessionStorage polyfill.

Overview

Note

This polyfill is dependent upon cookies so will not work where cookies can't be used (e.g., viewing the page offline).

The HTML5 sessionStorage object is used to store data for the current session. This component adds support for this object in browsers that do not already have native support.

This working example demonstrates how HTML5 sessionStorage works. It starts a session and maintains the session data for the duration of the session, even after navigating away from the page. Test this out by navigating to a new page (in the same tab/window) then either hitting the back button or manually navigating to the original page. Upon return, the timer will continue to show how long the session has been active since it was first initialized.