Browsers store sessions, preferences and offline data in several places. Knowing where to look makes state-related bugs easier to reproduce.
Storage types
| Type | Typical use | Lifetime |
|---|---|---|
| Cookie | Session ID, preferences | Session or set expiry; sent with matching requests. |
| localStorage | Persistent browser preferences | Until cleared. |
| sessionStorage | Temporary tab state | Until the tab or session ends. |
| IndexedDB | Structured or offline application data | Until cleared. |
| Cache Storage | Responses used by service workers | Managed by the application or browser. |
| HTTP cache | Reusable network responses | Controlled by response headers and browser policy. |
Cookies
In DevTools, open Application → Storage → Cookies. Check name, value, domain, path, expiry and these flags:
- Secure: cookie is sent over secure connections.
- HttpOnly: JavaScript cannot read the cookie.
- SameSite: controls when cross-site requests include it.
Web storage
// Inspect
localStorage
sessionStorage
// Read and change
localStorage.getItem('theme')
localStorage.setItem('theme', 'dark')
localStorage.removeItem('theme')
// Clear all values for this origin
localStorage.clear()
Storage is scoped by origin. Similar staging URLs may not share values.
IndexedDB and cache
Use the Application panel to browse IndexedDB object stores and Cache Storage entries. In Network, enable Disable cache while DevTools is open to compare fresh requests. Use Clear site data for a clean-state test.
Common test scenarios
Clear site data and verify defaults, consent and onboarding.
Reload, close the tab and restart the browser. Confirm the correct state survives.
Verify session data is removed and protected pages cannot be reopened.
Change state in one tab and observe whether another updates correctly.
Edit or remove values and verify safe recovery.
Test storage failure, cached content and reconnection.
- Test with storage blocked or cookies disabled where supported.
- Check expiry and clock-related behaviour.
- Verify one user cannot see another user's cached data.
- Confirm application updates migrate or discard old stored data safely.