CORS同步请求无法在Firefox中运行

jQuery( async ajax部分 )的官方文档说:

跨域请求和dataType:“jsonp”请求不支持同步操作。

但是这适用于所有最近的浏览器,但firefox版本> = 20.这是我正在进行的调用类型:

$.ajax({ type : "GET", async: false, dataType : "text", url : link, xhrFields: { withCredentials: true }, success: function(response){ console.log("success "); }, error: function(error){ console.error(error); } }); 

有没有人知道为什么会这样?

更新:我用jQuery和vanilla XHR测试了错误总是一样的

[例外……“底层对象不支持参数或操作”代码:“15”nsresult:“0x8053000f(InvalidAccessError)”

使用beforeSend而不是xhrField

 $.ajax({ type : "GET", async: false, dataType : "text", url : link, beforeSend: function(xhr) { xhr.withCredentials = true; }, success: function(response){ console.log("success "); }, error: function(error){ console.error(error); } });