D3.JS - Unable to load a CSV file - Fetch API cannot load file. URL scheme must be "http" or "https" for CORS request

D3.JS - Unable to load a CSV file - Fetch API cannot load file. URL scheme must be "http" or "https" for CORS request
0

#1

I have a csv file in the same directory as my .html page.

Below is my markup and js.

CSV Data Binding

When I launch Chrome I get below error in the Console Window:

Fetch API cannot load file. URL scheme must be “http” or “https” for CORS request.

I have also tried to to run Chrome from the command line and setting the --allow-file-access-from-file property and I still get the same error.

Anyone got any ideas?


#2

You need to open your html file via http server. If you’re on windows google “windows http server”.


#3

you can use a proxy url like:

  1. https://crossorigin.me
  2. https://cors-anywhere.herokuapp.com/

You just need to attach to your api’s url at the start.