Javascript Google Chrome 中的跨域设置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2600574/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 01:05:14  来源:igfitidea点击:

Crossdomain settings in Google Chrome

javascriptajaxgoogle-chromecross-domain

提问by jAndy

I'm wondering, in IE & Firefox you're able to setup the browser, to allow cross-domain calls.

我想知道,在 IE 和 Firefox 中,您可以设置浏览器以允许跨域调用。

I can't find any option in chrome for that (actually, there are in general not too much options at all...)

我在 chrome 中找不到任何选项(实际上,通常根本没有太多选项......)

are there any about:config like things?

有关于:配置之类的东西吗?

Kind Regards

亲切的问候

--Andy

——安迪

采纳答案by Kinlan

No. Sorry.

不,对不起。

Chrome and Firefox, however do support cross-domain requests via the W3C CORSspec (Cross Origin resource sharing) however the remote host has to enable it. If the remote host supports it explicitly then you don't have to make any changes to your XMLHttpRequest to be able to fetch the content.

但是,Chrome 和 Firefox 确实通过W3C CORS规范(跨源资源共享)支持跨域请求,但是远程主机必须启用它。如果远程主机明确支持它,那么您不必对 XMLHttpRequest 进行任何更改即可获取内容。

回答by Ashish Agarwal

This answer was correct when written, but is longer correct, the switch has been deprecated

这个答案在写时是正确的,但不再正确,开关已被弃用

Chrome has a command line switch for this:

Chrome 有一个命令行开关:

chrome.exe --disable-web-security

You can view a full list (as of when it was posted!) of command line options for chrome here.

您可以在此处查看 chrome 命令行选项的完整列表(截至发布时间!)。

回答by jiahut

You can install chrome plugins which enable cross-origin resource sharing .

您可以安装启用跨源资源共享的 chrome 插件。

I use this.

我用这个