javascript – 尝试禁用Chrome同源的策略

前端之家收集整理的这篇文章主要介绍了javascript – 尝试禁用Chrome同源的策略前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图遵循一个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

当我尝试在Chrome中运行游戏时,我仍然收到这个错误

XMLHttpRequest无法加载文件:/// C:/Users/danniu/Desktop/JavaScript/melonJS/data/map/area01.tmx.仅支持HTTP请求的跨源请求.

我究竟做错了什么?

谢谢

解决方法

您需要使用两个参数.这是我如何在我的mac上运行它.
open -a Google\ Chrome --args --disable-web-security -–allow-file-access-from-files

这是Windows应该是如何的:

"C:\PathTo\Chrome.exe" –allow-file-access-from-files -disable-web-security
原文链接:https://www.f2er.com/js/150645.html

猜你在找的JavaScript相关文章