试图禁用Chrome同源策略 [英] Trying to disable Chrome same origin policy
问题描述
- disable-web-security
- 允许文件从文件访问**
我在我的命令提示符中尝试了这两种方法:
C:\ Users \danniu> C: \ Users \danniu\AppData\Local\Google\Chrome\Application\Chrome.e
xe - 允许文件从文件访问
C:\ Users \danniu> C:\ Users \danniu\AppData\Local\Google\Chrome\Application\Chrome.e
xe --disable-web-security
当我尝试在Chrome中运行游戏时,仍然收到此错误:
XMLHttpRequest无法加载file:/// C:/Users/danniu/Desktop/JavaScript/melonJS/data/map/area01.tmx。只有HTTP支持跨源请求。
我做错了什么?
感谢
您需要使用两个参数。这是我如何在我的Mac上运行它。
open -a Google\ Chrome --args --disable-web-安全 - 允许文件从文件中访问
这对于Windows应该是这样的:
C:\ PathTo\Chrome.exe-allow-file-access-from-files -disable-web - 安全
I'm trying to follow a melonJS tutorial. It says I should disable cross-origin request using one of two methods:
--disable-web-security
--allow-file-access-from-files**
I've tried both of these in my command prompt as such:
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
When I try to run the game in Chrome I'm still getting this error:
XMLHttpRequest cannot load file:///C:/Users/danniu/Desktop/JavaScript/melonJS/data/map/area01.tmx. Cross origin requests are only supported for HTTP.
What am I doing wrong?
Thanks
You need to use both arguments. This is how I run it on my mac.
open -a Google\ Chrome --args --disable-web-security -–allow-file-access-from-files
This is how it should be for windows:
"C:\PathTo\Chrome.exe" –allow-file-access-from-files -disable-web-security
这篇关于试图禁用Chrome同源策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!