jargon

Comparison

CookievslocalStorage

Cookie

the value went out with every single request to that domain, whether it was needed or not.

A small piece of data the browser stores and attaches automatically to matching requests. That automatic attachment is the entire difference from other storage: it is what makes cookies work for sessions and what makes them cost bytes on every request. Size limits are small, the attributes controlling scope and security are numerous, and the ones that matter are `HttpOnly`, `Secure` and `SameSite`.

Full entry →

localStorage

you saved the preference and it was still there a week later, on that browser only.

A synchronous key-value store of strings, scoped to the origin, with no expiry. It is convenient and it is synchronous on the main thread, which means a large read blocks rendering. It is readable by any script on the origin, so nothing sensitive belongs in it, and the accessor itself throws in some privacy modes, so every access needs wrapping.

Full entry →

Related comparisons