Web storage api
The Web Storage API is a browser API for storing string key-value data on the client side in origin-associated storage areas such as localStorage and sessionStorage.
HTML5 in Action
A browser API that provides client-side storage through the sessionStorage and localStorage interfaces.
- How it is used
- Stores client-side application settings as an alternative to cookies or a remote database.
- How deep it goes
- Walks through reading, saving, deleting and connecting settings to the interface, while contrasting session and persistent storage.
- Examples
- Uses a mobile task app’s name and color preferences to demonstrate saving, loading and clearing settings.
- What you can do after
- Apply it via localStorage to manage settings and update an application interface.
Acing the Frontend Interview
The Web Storage API is a browser interface for storing string key-value pairs on the client side through storage areas such as localStorage and sessionStorage.
- How it is used
- Uses localStorage for small, non-sensitive client-side persistence such as user preferences.
- How deep it goes
- Explains feature detection, core methods, persistence, string conversion, limits, synchronous operations, and security considerations.
- Examples
- Uses numeric and object values to demonstrate automatic string conversion.
- What you can do after
- Apply localStorage safely by detecting support, using its methods, and accounting for string-only storage and sensitive data.
Read how Acing the Frontend Interview explains web storage api →
Vanilla Web
Web Storage is a browser storage facility for small amounts of string key/value data associated with a web origin.
- How it is used
- Uses browser storage for small, string-based settings and state that are inexpensive to rebuild.
- How deep it goes
- Explains persistence, JSON serialization, synchronous access, and cross-tab events, while ruling out database-scale use.
- Examples
- Uses theme preferences, dismissed banners, last-opened panels, JSON-stored objects, and cross-tab preference updates.
- What you can do after
- Apply native Web Storage methods to persist small preferences and respond to changes from other same-origin tabs.
Also covered in
What to know first
- cookieAn HTTP cookie is a small piece of data stored by a client and sent with subsequent requests within its scope, often to maintain state or preferences.
- HTTPHTTP is an application-layer protocol that defines request-and-response communication for transferring resource representations and related metadata between networked systems.
- JavaScriptJavaScript is a high-level, dynamically typed programming language standardized as ECMAScript and used for web and general-purpose programming.
- JSONJSON is a language-independent text-based data-interchange format that represents structured values using objects, arrays, strings, numbers, booleans, and null.
Related concepts
- cookiealternative to · An HTTP cookie is a small piece of data stored by a client and sent with subsequent requests within its scope, often to maintain state or preferences.
- local storagehas part · Local storage is a browser-provided, origin-scoped key-value storage mechanism for string data that persists across sessions.
- IndexedDBcontrasts with · IndexedDB is a browser API for asynchronously storing and querying structured data in transactional, indexed client-side databases.
- originconfigured by · A web origin is the security identity defined by a resource's scheme, host, and port.
Questions about web storage api
What is web storage api?
The Web Storage API is a browser API for storing string key-value data on the client side in origin-associated storage areas such as localStorage and sessionStorage.
Which Manning books explain web storage api?
HTML5 in Action, Acing the Frontend Interview and Vanilla Web.
What should I know before learning web storage api?
Manning books that teach web storage api usually introduce cookie, HTTP, JavaScript and JSON first.
What is the difference between web storage api and cookie?
The Web Storage API is a browser API for storing string key-value data on the client side in origin-associated storage areas such as localStorage and sessionStorage. An HTTP cookie is a small piece of data stored by a client and sent with subsequent requests within its scope, often to maintain state or preferences.
What is web storage api part of?
Web storage api is part of HTML Living Standard. The HTML Living Standard is the continuously maintained specification defining HTML and associated web-platform APIs and processing behavior.
What are the parts of web storage api?
Web storage api includes session storage and local storage.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


