-2

I'm running a local server but my console says that it still can't load the images from my system. My images are inside a folder and I'm trying to load it. I have tried using several servers - xampp, npm node.js, vscode live server, servez and even though my servers are running it does not display the image.

These are the errors,

Not allowed to load local resource:

and

"GET /favicon.ico" Error (404): "Not found"

I've been having this issue for a while. I'm trying to work with JavaScript and p5 so I require images from my system. How do I get rid of these errors and be able to load images from my system folder. Thank you, any help is appreciated

rishi
  • 643
  • 5
  • 21

1 Answers1

1

The error states that in the root project favicon.ico file doesn't exist, so grab a copy of favicon.ico and put it in your root project directory.

Maverick Fabroa
  • 1,105
  • 1
  • 9
  • 15
  • Could you provide more details on how to do it? I mean I just need a picture there? – rishi Sep 13 '20 at 15:30
  • Your project needs an icon file, the `favicon.ico` file. Put it in your root project (should be the same directory as index.html) – Maverick Fabroa Sep 13 '20 at 15:32
  • Right I'm not getting that error anymore however I still can't load the images from my system – rishi Sep 13 '20 at 15:38
  • Create a folder called `assets` and put your images inside it and refer it to your html or js. – Maverick Fabroa Sep 13 '20 at 15:41
  • I'm using p5 library an I'm loading the images using its loadImage function, however putting it in assets folder didn't make it work. In fact I still get an error message in my console saying ```failed to load local resource``` – rishi Sep 13 '20 at 15:48
  • I just noticed that I'm not able to load my javascript file – rishi Sep 13 '20 at 15:54
  • 1
    Thank you for your time I was able to figure out how tro solve the problem. ```http://127.0.0.1:8080/src/sketch.js``` – rishi Sep 13 '20 at 15:58