Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

CORS error while loading file from github

lovebug

Active Coder
Hi, sorry to bother you guys but I've tried to find an answer to this but I'm not having any luck

So my website has a Javascript based bbc micro computer emulator (js-beeb) which loads my game project file from github
Well that is it used to load my game project file from github but now it fails and when I checked the browser console log I see something about CORS

I really don't know how to fix this, is it possible to fix this error ?

Heres the link to my website page that is having the issue

And the error message
Code:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://github.com/LoveBug2084/LadyBug/raw/main/src/Lady%20Bug.ssd. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘’).

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://github.com/LoveBug2084/LadyBug/raw/main/src/Lady%20Bug.ssd. (Reason: CORS request did not succeed). Status code: (null)

As a temporary fix I have added a single line of PHP code to copy the file from github to my website but would prefer to load the file from the external github site if possible

New temporary fix

Thanks
 
Last edited:
Hey @lovebug,

No question will ever bother us. Code Forum is meant to be a resource for helping with questions like these.

But yes, so CORS (Cross Origin Resource Sharing) is a system that defines how the application domain interacts with resources hosted on other domains. It's pretty much a security feature.,

Now I believe this occurs when you're trying to fetch a resoruce, I have never really experienced it outside those parameters but normally this can be find within the fetch function.

Just to make sure, are you using Node.js or javascript?
 
js-beeb isnt written by me but is a free open source bbc micro computer emulator available on github

you can specify the filename in the url with disc=

this used to work fine but just recently when I compiled a new game build and tested it on my site I found I get a CORS error
 
js-beeb isnt written by me but is a free open source bbc micro computer emulator available on github

you can specify the filename in the url with disc=

this used to work fine but just recently when I compiled a new game build and tested it on my site I found I get a CORS error
Okay gotcha, sorry to ask but can you tell me where you entered the URL/filename? I want to take a look at the function.
 
My apologies for the delayed response, lovebug. It's been quite a busy week.
Thanks, i'll have to look through the javascript to try and find the function that processes the parameters in the url
its the disc= one that i'll look for

https://lovebyte.eu.org/jsbeeb-main/ ?autoboot & noseek & disc=https://github.com/LoveBug2084/LadyBug/raw/main/src/Lady Bug.ssd
So it turns out that what used to work now doesn't but there is an alternate url that does work (for now anyway)


Thanks again for your time 👍👍👍👍👍
Do you still get the CORS error or has that disappeared as well?
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom