← All tutorials

GoCareerGo Tutorials

HTML Tutorial

Tags, attributes, HTML5 APIs and semantic markup — the web's foundation.

Web Storage API

localStorage and sessionStorage let you store key-value data in the browser, no server needed.

localStorage.setItem('theme', 'dark');
localStorage.getItem('theme'); // 'dark'
localStorage.removeItem('theme');

sessionStorage.setItem('draft', 'unsent message');
  • localStorage — persists until explicitly cleared, shared across tabs on the same origin
  • sessionStorage — cleared when the tab closes, scoped to that one tab
  • Both store strings only — JSON.stringify/parse objects before storing