Build-A-Quiz-App-With-HTML-CSS-and-JavaScript
Build-A-Quiz-App-With-HTML-CSS-and-JavaScript copied to clipboard
Error: Access to fetch at 'file:///Users/questions.json' from origin 'null' has been blocked by CORS policy!
trafficstars
Hi, I'm get this error message when I try to execute fetch. Any ideas for a fix? Thanks
Its because a html page cannot access file using file:///Users, its done for users security so that websites don't access any other personal / system files
create a http server and run the application on it
Alternatively, you can install python 3
- cd into the main project directory
- python -m http.server or python3 -m http.server
you will get a message like Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ... open that link and you are good to go