I searched for a long time but couldn't find my answer, all other CORS topics talking about http requests. I'm trying to load a file with the d3 library and it doesn't work. The most disturbing thing is that the exact same code works on a friend's computer.
Asked
Active
Viewed 1,176 times
-1
-
The error states clearly that you need a http or https URL, as opposed to a file:/// one. To get this to run, you need a local webserver. Apache2 will do, or any other local web server. – Dec 18 '20 at 14:59
-
1Duplicate: ["Cross origin requests are only supported for HTTP." error when loading a local file](https://stackoverflow.com/questions/10752055/cross-origin-requests-are-only-supported-for-http-error-when-loading-a-local) – Dec 18 '20 at 15:06
1 Answers
0
For that you have to create an http server on your localhost. There are many ways but one of the easier ways is to use the "Live server" extension on vscode. It will also reload the tab when you change your code.

Etienne Bibaud
- 69
- 1
- 5