Gro*_*ler 8 javascript security google-chrome same-origin-policy
我正在尝试遵循melonJS教程.它说我应该使用以下两种方法之一禁用跨源请求:
- 禁用网络安全
--allow-文件访问从档案**
我在命令提示符中尝试了这两个:
C:\Users\danniu>C:\Users\danniu\AppData\Local\Google\Chrome\Application\Chrome.e
xe --allow-file-access-from-files
C:\Users\danniu>C:\Users\danniu\AppData\Local\Google\Chrome\Application\Chrome.e
xe --disable-web-security
Run Code Online (Sandbox Code Playgroud)
当我尝试在Chrome中运行游戏时,我仍然收到此错误:
XMLHttpRequest cannot load file:///C:/Users/danniu/Desktop/JavaScript/melonJS/data/map/area01.tmx. Cross origin requests are only supported for HTTP.
我究竟做错了什么?
谢谢
Jai*_*ime 11
您需要使用这两个参数.这是我在我的Mac上运行它的方式.
open -a Google\ Chrome --args --disable-web-security -–allow-file-access-from-files
Run Code Online (Sandbox Code Playgroud)
这是它应该如何为Windows:
"C:\PathTo\Chrome.exe" –allow-file-access-from-files -disable-web-security
Run Code Online (Sandbox Code Playgroud)