有没有办法在谷歌的Chrome浏览器上禁用同源策略?
当前回答
在Ubuntu中使用以下命令启动chrome(禁用同源策略并在分离模式下打开chrome):
nohup google-chrome --disable-web-security --user-data-dir='/tmp' &
其他回答
只有对于OSX Catalina,以下命令对我有效。
open-n-a/Applications/Google\Chrome.app/Contents/MacOS/Google\Chrome--args--用户数据dir=“/tmp/Chrome_dev_test”--禁用web安全
若您在Linux上使用Google Chrome,则以下命令有效。
google-chrome --disable-web-security
根据奥拉·卡尔森的回答,最好的方法是在不同的会话中打开不安全的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
使用当前最新的chrome版本103.0.5060.134(官方版本)(64位)
windows:单击开始按钮,然后复制粘贴以下内容(根据您的喜好更改D:\temp)。:
chrome.exe --disable-site-isolation-trials --disable-web-security --user-data-dir="D:\temp"
Linux:启动终端,然后运行以下命令(根据需要更改~/tmp目录)
google-chrome --disable-site-isolation-trials --disable-web-security --user-data-dir="~/tmp"
注意:此解决方案将在独立的沙盒中启动chrome,并且不会影响主chrome配置文件。
对于使用**Chrome版本60.0.3112.78(解决方案测试和工作的当天)的windows用户,至少到今天为止是2022年11月24日(版本106.05.249.119(官方版本)(64位))。您不需要关闭任何chrome实例。
在桌面上创建快捷方式右键单击快捷方式,然后单击“财产”编辑Target属性将其设置为“C:\Program Files(x86)\Google\Chrome\Application\Chrome.exe”--禁用web安全--用户数据dir=“C:\ChromeDevSession”启动chrome并忽略消息:禁用网络安全不受支持!
注意不要使用这个特定的浏览器实例进行浏览,因为你可能会被黑客入侵!