sessionStorage
sessionStorage is scoped to the current browser tab session. Opening the same URL in a new tab creates a separate, empty sessionStorage.
sessionStorage is scoped to the current browser tab session. Opening the same URL in a new tab creates a separate, empty sessionStorage.
// Useful for single-session data
sessionStorage.setItem("formStep", "2");
sessionStorage.setItem("cartId", "abc-123");
// Data is lost when the tab is closed
// Each tab has its own isolated sessionStorage
// Good use cases:
// - Multi-step form progress
// - Temporary filters
// - Tab-specific state
// - Cart before login
Use sessionStorage for single-visit state that should reset on a new visit, like multi-step wizard progress.
More in JavaScript