首页 > ajax 跨域cookie

ajax 跨域cookie

ajax跨域请求,cookie怎么拿得到。


是带 cookie 的跨域请求吗?按 MDN 文档正确设置即可。关键在于发送时设置:

jsxhr.withCredentials = true;

然后服务器返回要有头:

Access-Control-Allow-Origin: http://foo.example
Access-Control-Allow-Credentials: true

其中域名那里不能用星号!


好多人说域名设置为*,那样没有成果!

【热门文章】
【热门文章】