Guides ยท Technology
Browser Storage Basics
Pick the right web storage option
This guide covers browser storage options: cookies for small cross-request data, local/sessionStorage for simple key-values, and IndexedDB for structured larger data, plus security considerations for each.
- browser storage
- cookies
- localStorage
- sessionStorage
- indexeddb
Cookies
Sent with requests; small; use HttpOnly/Secure; avoid storing secrets in JS-accessible cookies.
Local vs sessionStorage
Key-value storage in the browser; session clears on tab close; avoid sensitive data.
IndexedDB
Async structured storage for larger data; needs feature detection and error handling.
Security choices
Prefer HttpOnly cookies for auth tokens; validate and handle storage failures gracefully.