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

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?

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

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.

1 Like