有没有办法在谷歌的Chrome浏览器上禁用同源策略?
当前回答
在Linux-Ubuntu上,要同时运行正常会话和不安全会话,请运行以下命令:
google-chrome --user-data-dir=/tmp --disable-web-security
其他回答
您可以简单地使用这个chrome扩展名Allow Control Allow Origin
只需单击扩展图标即可根据需要打开或关闭跨资源共享
有一个名为CORS Toggle的Chrome扩展。
单击此处访问并将其添加到Chrome。
添加后,将其切换到打开位置以允许跨域请求。
在Linux-Ubuntu上,要同时运行正常会话和不安全会话,请运行以下命令:
google-chrome --user-data-dir=/tmp --disable-web-security
在Mac终端上尝试此命令-
open -n -a "Google Chrome" --args --user-data-dir=/tmp/temp_chrome_user_data_dir http://localhost:8100/ --disable-web-security
它打开了另一个具有禁用安全性的chrome实例,并且不再存在CORS问题。此外,您不再需要关闭其他chrome实例。将localhost URL更改为您的URL。
对于Windows:
(使用windows 8.1,chrome 44.0)
首先,关闭谷歌chrome。
然后,打开命令提示符并转到“chrome.exe”所在的文件夹。
( for me: 'chrome.exe' is here "C:\Program Files (x86)\Google\Chrome\Application".
所以我键入:cd C:\Program Files(x86)\Google\Chrome\Application)
现在键入:chrome.exe--禁用web安全
一个新的铬窗口将打开。