sessionStorage
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
sessionStorage.removeItem('myTempDatakey');
⏰ Preorder my new course on Web Components! Want to learn how to build Web Components from scratch, master best practices, and more? Preorder today and get $100 off of the launch price.
Find this useful? You can support my work by purchasing an annual membership.