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


当前回答

在Windows PC上,使用较旧版本的Chrome,该命令将适用于所有人。我把我的Chrome降到了26版,而且效果不错。

其他回答

您可以简单地使用这个chrome扩展名Allow Control Allow Origin

只需单击扩展图标即可根据需要打开或关闭跨资源共享

若您在Linux上使用Google Chrome,则以下命令有效。

google-chrome  --disable-web-security

对于Selenium Webdriver,在这种情况下,您可以使用适当的参数(或“开关”)让Selenium启动Chrome。

 @driver = Selenium::WebDriver.for(:Chrome, { 
       :detach => false,
       :switches => ["--disable-web-security"]
    })

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

有一个名为CORS Toggle的Chrome扩展。

单击此处访问并将其添加到Chrome。

添加后,将其切换到打开位置以允许跨域请求。