Trying to disable Chrome same origin policy

Growler picture Growler · Feb 25, 2014 · Viewed 73.7k times · Source

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

Answer

Jaime picture Jaime · Feb 25, 2014

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