Equivalent of Fetch 'no-cors' mode in XHR or Ajax libraries?

强颜欢笑 提交于 2021-02-18 21:00:05

问题


Is there a way to write fetch {mode: 'no-cors'} in an existing (and most browsers supported) HTTP request? As an example, I would like to know if it's possible to translate this:

fetch(url, { mode: 'no-cors'})
.then(function (response) {
  console.log(response);
});

Into a XMLHttpRequest or Ajax of some sort. I tried several ways and they behave differently - I just want the opaque response that fetch returns.

Thanks!

来源:https://stackoverflow.com/questions/54660924/equivalent-of-fetch-no-cors-mode-in-xhr-or-ajax-libraries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!