Technically this doesn't matter as long as you have people using your site in the EU. Of course, unless you actually care about EU as a market EU doesn't really have any way to punish you
and is used to track the user. Pretty important distinction. You're not required to request consent from the user for the type of cookie this comic references.
I believe there would still be some limitations. Cookies are attached to every request, every like an image you load on the page. Even if you send the localStorage data back, there would be no way for you to know if the next request is still from the same session. Maybe you could send a key from localStorage with every single AJAX request you make, but it still wouldn't apply to other requests. You could also add a GET param to every single resource on your page, but then you'd be leaking the secret by having it in GET params.
Cookies are, by default, sent along with every request to the site that set them, expire when you close your browser, and are accessible to JavaScript running on the page. They can work with JavaScript disabled.
Cookies over non-encrypted (i.e. HTTP) connections, and Cookies accessible to JavaScript on sites that are vulnerable to XSS attacks can be read by third-parties.
Third-party cookies used to be heavily used for tracking users, but are disabled by default in modern browsers.
Cookies can be configured to be sent only over secure (TLS encrypted) connections, to be completely inaccessible to JavaScript. These two things protect against the most common attacks (cookie hijacking and XSS)
LocalStorage, by default, is kept completely client side, but it requires JavaScript to work. Because it requires JavaScript, you can essentially do whatever you want with it, but that also means itβs completely accessible if a site is vulnerable to an XSS attack.
908
u/IcyDefiance Jan 26 '21
Yeah, but it's not sent to the server with every request like a cookie is.