有没有办法在谷歌的Chrome浏览器上禁用同源策略?
当前回答
使用当前最新的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配置文件。
其他回答
若您在Linux上使用Google Chrome,则以下命令有效。
google-chrome --disable-web-security
在Windows 10上,以下功能将起作用。
<<path>>\chrome.exe --allow-file-access-from-files --allow-file-access --allow-cross-origin-auth-prompt
在Mac终端上尝试此命令-
open -n -a "Google Chrome" --args --user-data-dir=/tmp/temp_chrome_user_data_dir http://localhost:8100/ --disable-web-security
它打开了另一个具有禁用安全性的chrome实例,并且不再存在CORS问题。此外,您不再需要关闭其他chrome实例。将localhost URL更改为您的URL。
对于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 PC上,使用较旧版本的Chrome,该命令将适用于所有人。我把我的Chrome降到了26版,而且效果不错。