Normal cookies are JS-accessible, but HTTP-only cookies should not be: "A cookie with the HttpOnly attribute is inaccessible to the JavaScript Document.cookie API; it is sent only to the server."
Which is why you use domain scoping, httpOnly and Secure cookie flags so they can only be read by matching hosts (with greater granularity than same-origin policy) over HTTPS and can’t be read by JavaScript. The Web Storage API does not offer these protections.
asabil|4 years ago
leipert|4 years ago
AlbinoDrought|4 years ago
https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#re...
fractionalhare|4 years ago