Reading a cookie from another domain?

Can javascript read cookie from another domain? \

If I set a cookie in one domain, say www.domain1.com. Can I read this cookie from another domain www.domain2.com?

If so, how?

+5
source share
2 answers

No, the property document.cookiegives you access to cookies related to this page. The ability to read other cookies will be a pretty significant security issue.

+9
source

No.

Browsers specifically provide cookies for this domain to the current domain. This is a safety feature.

You can even indicate where on your site this cookie can be obtained by adding a path.

+2

All Articles