Yep.
(是的)
For OSX, open Terminal and run: (对于OSX,打开终端并运行:)
$ open -a Google Chrome --args --disable-web-security --user-data-dir
--user-data-dir required on Chrome 49+ on OSX
(--OSX上的Chrome 49+需要--user-data-dir)
For Linux run:
(对于Linux运行:)
$ google-chrome --disable-web-security
Also if you're trying to access local files for dev purposes like AJAX or JSON, you can use this flag too.
(另外,如果您尝试出于开发目的(例如AJAX或JSON)访问本地文件,也可以使用此标志。)
-–allow-file-access-from-files
For Windows go into the command prompt and go into the folder where Chrome.exe is and type
(对于Windows,请进入命令提示符并进入Chrome.exe所在的文件夹,然后键入)
chrome.exe --disable-web-security
That should disable the same origin policy and allow you to access local files.
(那应该禁用相同的原始策略,并允许您访问本地文件。)
Update: For Chrome 22+ you will be presented with an error message that says:
(更新:对于Chrome 22+,您将看到一条错误消息,内容为:)
You are using an unsupported command-line flag: --disable-web-security.
(您正在使用不受支持的命令行标志:--disable-web-security。)
Stability and security will suffer. (稳定性和安全性将受到损害。)
However you can just ignore that message while developing.
(但是,您可以在开发时忽略该消息。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…