Can jQuery.getJSON put a domain's cookies in the header of the request it makes?

前端 未结 2 696
無奈伤痛
無奈伤痛 2021-01-20 18:35

(Note: See also the related question Can browsers react to Set-Cookie specified in headers in an XSS jquery.getJSON() request?)

I can\'t seem to set a cookie

2条回答
  •  爱一瞬间的悲伤
    2021-01-20 19:19

    Are you running all of your tests through localhost? Are you using IE? If so it will be enforcing its own special brand of security requirements and likely dumping your cookies. Open fiddler and use http://ipv4.fiddler to bypass that.

    If that type of trickery is not going on (as it appears you are using FireFox) , it may also be the case that you do need to explicitely set the cookie's domain to be the same as the domain of your JSON request. A browser won't send cookies set for domain A to a request to domain B. I am not 100% sure this is the case though.

提交回复
热议问题