HTML5 Local Storage Revisited

Yeah, those two differences are the significant ones.

Cookies only give you 4K, which is obviously a lot less than 2-10MB!

Cookies can be written and read by the server, but storage is client-side only (although Node.js has a storage extension with the same syntax, and that data can be passed across the network).

The network difference also gives rise to a minor security benefit, in that local storage data can’t be intercepted by man in the middle attacks. But local storage isn’t secure storage, and it’s just as easy for users to modify their own storage data, eg. to modify stored credentials in order to assume another identity (if they know the other identity’s credentials). And of course it’s just as vulnerable to XSS attacks as any other data.

Oh, and storage has an event which fires in response to storage changes. This event is the mechanism through which you can communicate between windows and tabs (because it fires in all instances, not just the active one; it would also make it possible to implement cross-window drag and drop with keyboard support, but that’s another article!).

I think that’s it, can’t think of anything else – unless you count browser support (obviously much wider for cookies); or the fact that local storage is way cleaner and easier to use :smile: