有没有办法在谷歌的Chrome浏览器上禁用同源策略?
当前回答
我发现最好的方法是在windows桌面上复制Chrome或Chrome Canary快捷方式。将此快捷方式重命名为“NO CORS”,然后编辑该快捷方式的财产。
在目标路径的末尾添加--disable-web security--user data dir=“D:/Chrome”。
你的目标应该是这样的:
更新:添加了新标志。
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir="D:/Chrome"
其他回答
只有对于OSX Catalina,以下命令对我有效。
open-n-a/Applications/Google\Chrome.app/Contents/MacOS/Google\Chrome--args--用户数据dir=“/tmp/Chrome_dev_test”--禁用web安全
在Windows 10上,以下功能将起作用。
<<path>>\chrome.exe --allow-file-access-from-files --allow-file-access --allow-cross-origin-auth-prompt
您可以简单地使用这个chrome扩展名Allow Control Allow Origin
只需单击扩展图标即可根据需要打开或关闭跨资源共享
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
编辑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)
基本上,它是一个小切换开关,用于打开和关闭“允许访问源代码控制”检查。对于我所做的一切来说,这是完美的。