简体   繁体   中英

Reading Cookie from a different domain?

Can javascript read a cookie from a different domain?\\

If i set a cookie in one domain say www.domain1.com. Can i read that cookie from a different domain www.domain2.com?

If yes, how?

No, the document.cookie property only gives you access to the cookies relevant to that page. Being able to read other cookies would be a fairly significant security issue.

No.

Browsers specifically only give the current domain the cookies for that domain. This is a security feature.

You can even further specify where on your site this cookie is able to be accessed by adding a path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM