This is common error when you attempt to open load files directly in chrome.
Chrome and other browsers have imposed security restrictions for “Cross Origin Requests“, which means that you cannot load the files directly from your local hard-disk to browser hence you required to load the files on some server using some protocol. Eg: http.
There are different ways to resolve this issue:
Approach-1:- Search for the path of your Chrome executable and then, on your cmd, try :
- Type “where chrome” into command prompt which will give you “C:PathToChrome.exe”
- Then type ” C:PathToChrome.exe –allow-file-access-from-files “
Note:-It is better to close all the browser instances before executing the above commands.
Approach-2:- If you have node setup then you can use http-server.
Execute npm install –g http-server and you will be able to access it using http-server C:pathtoapp
Step1:- install node.js
sudo npm install –g http-server
Step2:- Browse to the file location of .html file and execute the below command
Step3:- Access the file using http://127.0.0.1:8080/ in browser
Approach-3:- Mount Apache server and deploy your code to run the app.
Note:-Some IDE’s have default built in web servers like JetBrains, Eclipse
Do follow us for more learning and solutions Fb,G+,Twitter