Having trouble with loading webpage

I’ve used things such as VScode, brackets and notepad in the past to create web pages.

However I cant seem to get it to work with P5.js.
I opened up a new sketch and saved the files in notepad, but upon opening the sketch it gets stuck on loading.

I’ve done this with other projects with more HTML, however the CSS is not applied and anything bellow the sketch doesn’t get shown.
These use the same code:
LEFT: was opened via File > Share and coping and pasting the link.
RIGHT: was opened via double clicking a copy of the HTML file. (with the CSS and JS files in the same folder but saved separately)

I don’t understand why this doesn’t work?

Can you open up your browser’s developer tools and check your JavaScript console for errors?

Here’s a guide on using your browser’s developer tools:

These are the errors coming up:

I tried searching ‘Not allowed to load local resources:’
I’m a little worried by some of the results saying I should disable security settings???

I found this
javascript - How can I fix “Not allowed to load local resource” error in microsoft edge or google chrome? - Stack Overflow

That suggests not double clicking the file to open in the browser :confused:
Should I be learning how to create a local host?
I have VScode on my device, but don’t know anything about hosting

For what it’s worth, this works fine for me in Firefox, but not in Chrome.

I think the problem is because you’re loading a local file:// URL, and then p5.js is loading a blob resources. Apparently Chrome doesn’t like that for some reason. I tracked this down to this bug:

Turns out this is caused by something in the p5.sound library, which you’re including in your index.html file. If you aren’t using that library, you should be able to remove the line that loads the library:

<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.6.0/addons/p5.sound.min.js"></script>

After that, this works fine for me in Chrome.

If you need the sound library, the more involved fix for this is running a local server instead of loading your files directly. But my guess is that removing the sound library will solve your problem for now.

1 Like

It worked :smiley:
Seems Microsoft Edge may have the same issues.
But this fixed it :smiley:

Have removed it from all my locally saved files and they are all working, thank you so much <3<3<3

1 Like

Yay! Glad you got it figured out. :heart_eyes_cat: