有没有办法在谷歌的Chrome浏览器上禁用同源策略?
当前回答
对于mac用户:
open -a "Google Chrome" --args --disable-web-security --user-data-dir
在Chrome 48之前,您可以使用:
open -a "Google Chrome" --args --disable-web-security
其他回答
对于mac用户:
open -a "Google Chrome" --args --disable-web-security --user-data-dir
在Chrome 48之前,您可以使用:
open -a "Google Chrome" --args --disable-web-security
编辑3:扩展似乎不再存在。。。这些天来,为了避开CORS,我通常会在单独的目录中设置另一个版本的Chrome,或者使用Firefoxhttps://addons.mozilla.org/en-US/firefox/addon/cors-everywhere/相反
编辑2:我再也无法让这项工作持续下去了。
编辑:前几天我试着用另一个项目,但它停止了工作。卸载并重新安装扩展修复了它(以重置默认值)。
原始答案:
我不想重启Chrome并禁用我的网络安全(因为我在开发时正在浏览),无意中发现了这个Chrome扩展。
Chrome Web Store允许控件允许来源:*(https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en)
基本上,它是一个小切换开关,用于打开和关闭“允许访问源代码控制”检查。对于我所做的一切来说,这是完美的。
根据奥拉·卡尔森的回答,最好的方法是在不同的会话中打开不安全的Chrome。这样,您就不必担心关闭所有当前打开的选项卡,也可以使用原始的Chrome会话继续安全地上网。
这些批处理文件应该只适用于Windows。
将其放在Chrome_CORS.bat文件中以便于使用
start "" "c:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir="c:/_chrome_dev" --disable-web-security
这张是给Chrome Canary的。金丝雀_ CORS.bat
start "" "c:\Users\%USERNAME%\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --user-data-dir="c:/_canary_dev" --disable-web-security
若您在Linux上使用Google Chrome,则以下命令有效。
google-chrome --disable-web-security
这是一个不断移动的目标。。。。今天我需要添加另一个标志以使其生效:--禁用站点隔离试验
操作系统X:open/Applications/Google\Chrome.app--args--用户数据dir=“/var/tmp/Chrome_dev_2”--禁用web安全--禁用站点隔离测试