3 ms·
What if you have a cookie set by http and try to update it with js? Will it self-destruct now?
by Dylan16807 7y ago
What if you have a cookie set by http and try to update it with js? Will it self-destruct now?
- cosmie 7y agoTechnically, when you update it via js you're overwriting the existing cookie with a new one. And, from my understanding, it's then subject to the same restrictions as any other cookie set client side. So in order to have a long-lived cookie, you essentially need to treat them as read-only client side, and push any and all update/write logic to the server such that it'll return a set-cookie header with any changes you require.
- tyingq 7y agoI would guess is works, but expiration is capped at today + 7 days.