Skip to main content Accessibility Feedback

Browser Storage


Use the local storage API to store data locally that the browser can access later. Data is cleared when the browser session ends, and must be a string.

// Store data
var someTempData = 'The data that I want to store temporarily.';
sessionStorage.setItem('myTempDataKey', someTempData);

// Get data
var tempData = sessionStorage.getItem('myTempDataKey');

// Remove data

Find this useful? You can support my work by purchasing an annual membership.