Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https

Viewed 81767

I'm facing this issue with chrome and IE. I have developed HTML player in that i used XML to load the data inside that player. all pages have been accessed through XML.it work fine when I use any server to load that data inside player.I use WAMP server now. But now I'm thinking about making it as an offline version and write it inside CD. but when I open my player.html file directly without having server, the XML data not going to load.it showing following error in the console.

XMLHttpRequest cannot load file:///C:/wamp/www/TTT_BR/english.xml. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

4 Answers

for testing/development purposes, the simplest solution is to use firefox browser.

Pretty much everyone has python on mac/linux by default. Who doesent, can easily get it.

python -m SimpleHTTPServer will give you a local server @ http://localhost:8000. From there you can access whatever file you'd like for your app.

Note: use python -m http.server for python versions 3.0+

Or you can run a web server like Apache and MySQL in XAMPP Control Panel. Put your file folder inside /htdocs inside /xampp folder and run your code in the browser using localhost.

Related