Reputation: 2440
It's possible to have two cookies with the same name but different values in document.cookie
if a subdomain and a domain set the same cookie.
For example, if I:
subdomain.domain.com
first, which sets a my_cookie=foo
cookie.domain.com
second, which sets a my_cookie=boo
cookie.document.cookie
in Chrome 81 will show my_cookie=foo; my_cookie=boo
on subdomain.domain.com
, in the order in which the cookies were set with the most recent cookie last.
My question is, can this ordering be relied on (and is there a rfc that talks about this)?
Upvotes: 3
Views: 241
Reputation: 261
Interestingly found this in an RFC about not relying on cookie orders between different subdomians:
reference: https://tools.ietf.org/rfc/rfc6265.txt
4.2.2. Semantics
Upvotes: 2