ajax:

通过给Response Header添加Access-Control-Allow-Origin:*  来解决跨域请求,*代表允许所有的跨域请求,或者把*换成指定的域名

 

cookie:

服务端需要在Response Header中加入头

Access-Control-Allow-Credentials:true 

然后客户端的ajax的withCredentials属性设置为True。  jquery中设置如下:

$.ajax({
url:"B.abc.com",
xhrFields:{
withCredentials:true
},
crossDomain:true
});

 

以上方式必须在IE11或以上浏览器上才能支持

相关文章:

  • 2022-02-15
  • 2021-11-02
  • 2021-05-02
  • 2021-11-01
  • 2022-12-23
  • 2021-12-31
  • 2021-09-25
  • 2022-12-23
猜你喜欢
  • 2021-05-03
  • 2021-12-06
  • 2021-11-17
  • 2022-02-15
  • 2021-12-28
相关资源
相似解决方案