DevTools → Application → Storage → Local Storage to inspect.
Great choice—localStorage is perfect for simple, client-only state like “which OS did we detect?” It’s simpler than cookies because:
It’s a key/value store in the browser tied to your origin.
Values persist until the user clears site data (no expiration attribute).
Data is not sent to your server automatically.
API is synchronous and string-based.
Quick API primer
localStorage.setItem(key, value) — store a string.
localStorage.getItem(key) — read a string or null if missing.
localStorage.removeItem(key) — delete one key.
localStorage.clear() — delete everything for your origin.
localStorage.length and localStorage.key(index) — iterate keys.
window.addEventListener('storage', ...) — detect changes from other tabs/windows of the same origin.
Basic pattern for your use-case
On load, attempt to read os from localStorage.
If missing, detect the OS and store it.
Use that value to branch UI/behavior.
Example (HTML + JS)
[this web page]
Tips and gotchas
Strings only: localStorage stores strings. For objects, use JSON.stringify and JSON.parse.
No expiration: It persists until cleared. If you need an expiry, implement it yourself (see below) or use sessionStorage for per-tab, cleared-on-tab-close behavior.
Availability: In some privacy modes or embedded contexts, localStorage may be disabled; wrap calls in try/catch as shown.
Performance: APIs are synchronous. For tiny values like an OS flag, this is fine.
Optional: add your own expiration
Debugging
In your browser’s DevTools, open the Application (or Storage) panel and inspect Local Storage for your origin.
You can edit/delete keys there to simulate first-visit behavior.
That’s it: detect once, store with localStorage.setItem('os', ...), read with getItem, and branch your UI.