Browser internals·Intermediate·Conceptual·1 min read
Can two different subdomains share localStorage?
Short interview answer
No. localStorage is partitioned by full origin, meaning scheme, host, and port must match exactly; app.example.com and api.example.com have separate localStorage even though they share a parent domain.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.