I’m starting the assessment on this page. I’ve copied the starting source code and the coffee.jpg image locally and started a localhost plain vanilla node server on port 3000. When I attempt to run the starter code, my console produces this error: async-sync.html:12 Fetch API cannot load file:///Users/artletter1/MDN-JS-Tuts/coffee.jpg. URL scheme must be “http” or “https” for CORS request.
What do I have to do in order to proceed with the exercise?
Note: For security reasons, you can’t fetch() files from your local filesystem (or run other such operations locally); to run the above example locally you’ll have to run the example through a local webserver.
Thank you for your quick reply! I thought I took care of that requirement by running a local Node server in that folder, but obviously not! How do I proceed?
I started a web server on my Mac with “sudo apachectl start”. When I navigate to localhost in my web browser I receive the “It works!” reply, so the webserver appears to be up and running. Yet I get the same error when attempting to run the MDN example.
@royjay
and you do not run the html file by just simply click on it you need to navigat to it using the webserver
each webserver has default folder you put your files there then you open your browser then access it using the following line
localhost/the folder name of your prject / your html file
or use 127.0.0.1 instead of the localhost word
In short, I’d recommend using Python HTTPSimpleServer, as I find it quick and easy to use.
But yes, you need to find out what URL the server is serving the content on, and navigate to that URL in your browser. It’ll look something like localhost:7000
@justsomeone, your last suggestion did the trick. Even though I had the web server up and running, I had navigated directly to the html file in my browser.