有没有办法在谷歌的Chrome浏览器上禁用同源策略?
当前回答
对于Windows。。。在桌面上创建Chrome快捷方式。右键单击>财产>快捷方式编辑“目标”路径:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --args --disable-web-security
(将“C:….\chrome.exe”更改为chrome所在的位置)。
等等:)
其他回答
对于Selenium Webdriver,在这种情况下,您可以使用适当的参数(或“开关”)让Selenium启动Chrome。
@driver = Selenium::WebDriver.for(:Chrome, {
:detach => false,
:switches => ["--disable-web-security"]
})
禁用此标志为chrome-chrome://flags/#reduced-引用者粒度它应该起作用
对于Windows。。。在桌面上创建Chrome快捷方式。右键单击>财产>快捷方式编辑“目标”路径:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --args --disable-web-security
(将“C:….\chrome.exe”更改为chrome所在的位置)。
等等:)
对于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安全
一个新的铬窗口将打开。
您可以简单地使用这个chrome扩展名Allow Control Allow Origin
只需单击扩展图标即可根据需要打开或关闭跨资源共享