I am receiving an error as below - kindly let me know what needs to be done? Access to XMLHttpRequest at 'file:///C:/Usersest1srcdatabase.json' from origin 'http://localhost:4200' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
Asked
Active
Viewed 34 times
1 Answers
0
You probably need to serve your app from a web server, if not already. You can do that via:
- http-server
- nginx (preferably docker)
- Web server for chrome
Could be a duplicate: AngularJS Error: Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https
And if you are already serving it from a web server, try reading that file using file reader and not via API call.

Abhijeet Ahuja
- 5,596
- 5
- 42
- 50