-1

I have two URLs, the first one is dev1.example.com, and the second one is dev2.example.com.

I am wondering if I set up a cookie in dev1.example.com, can I have access to that cookie in dev2.example.com?

  • Yes. You need to use `;domain=.example.com` in the cookie, otherwise it defaults to the subdomain. – Barmar May 19 '22 at 21:03
  • @Liftoff One of the answers there is for a cookie set by the server. The other requires use of a library. Do you know a question that shows how to do it in vanilla JS? – Barmar May 19 '22 at 21:05
  • @Barmar Yes, [here's an example](https://stackoverflow.com/questions/4713019/setting-cross-subdomain-cookie-with-javascript) – Liftoff May 19 '22 at 21:23

0 Answers0