Is the order in which cookies show up in document.cookie deterministic?

Viewed 62

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:

  1. Visit subdomain.domain.com first, which sets a my_cookie=foocookie.
  2. And then visit domain.com second, which sets a my_cookie=boocookie.

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)?

1 Answers
Related