I'm working on a cross platform (html5) project to be launched on Android and iOS later and I got a problem with getJSON
to load data from a .json file locally on chrome browser. When calling
jQuery.getJSON("layout.json", this.onLoaded);
I get
Error: XMLHttpRequest cannot load file:///E:/app/layout.json. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https`
at jquery-3.2.1.js:9566 which is: xhr.send( options.hasContent && options.data || null );
I've surfed the internet looking for solutions and came up with these two solutions that are not working in my case:
- Enabling access-control-allow-origin manually on chrome
- Upload the project files on a server
I'm looking for a solution to load the json data locally.
Your help is highly appreciated!