美文网首页
谷歌浏览器运行LayaAir IDE 2.0示例项目黑屏报错(M

谷歌浏览器运行LayaAir IDE 2.0示例项目黑屏报错(M

作者: beatzcs | 来源:发表于2019-04-18 11:40 被阅读0次

LayaAir2.0谷歌浏览器跨域问题解决方式

下载了LayaAir IDE 2.0.2beta版本, 新建LayaAir 2D示例项目, 然后打开 launch.json :

"runtimeExecutable": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",

然后点击运行chrome调试, 出现如下错误:

Access to XMLHttpRequest at 'xxxx.json' from origin 'null' has been blocked 
by CORS policy: Cross origin requests...

搜索得知是 Mac上的Chrome存在跨域问题, 解决方式为:

  1. 关闭掉运行着的谷歌浏览器;
  2. 打开终端;
  3. 输入命令:
open -n /Applications/Google\ Chrome.app/ --args --disable-web-security  --user-data-dir=/Users/beatzcs(电脑路径)/Documents/MyChromeDevUserData(自定义名称)/

然后谷歌浏览器就被打开, 设置完成.

发现路径文件夹下写入了一些文件:


MyChromeDevUserData.png

至此, 重新运行项目,成功运行~


社区答疑链接

相关文章

网友评论

      本文标题:谷歌浏览器运行LayaAir IDE 2.0示例项目黑屏报错(M

      本文链接:https://www.haomeiwen.com/subject/buyzwqtx.html