有没有办法在谷歌的Chrome浏览器上禁用同源策略?


当前回答

仅适用于MAC用户

open -n -a /Applications/Google\ Chrome.app --args --user-data-dir="/tmp/someFolderName" --disable-web-security

其他回答

在Ubuntu中使用以下命令启动chrome(禁用同源策略并在分离模式下打开chrome):

nohup google-chrome --disable-web-security --user-data-dir='/tmp' &

Chrome的Allow Control Allow Origin插件不起作用。这是针对MacOS的

我将别名chrome='open-n-a/Applications/Google\chrome.app/Contents/MacOS/Google\Chrme--args-user data dir--disable web security'作为别名添加到我的.profile中。

其他命令将禁用我的其他扩展,这将在禁用cors的情况下启动正常的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安全

一个新的铬窗口将打开。

对于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"]
    })