Transfering the code from CodePen to GitHub (or any other site)

I have done some projects on CodePen, and I was curious if I could publish them outside of CodePen.
So I tried copying my Random Quote Machine from CodePen to GitHub and published it using GitHub Pages. But it seems that the JavaScript is not working. On the console log, I’m getting the following error:

Failed to load https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=10&callback=: The 'Access-Control-Allow-Origin' header has a value 'https://s.codepen.io' that is not equal to the supplied origin. Origin 'https://sidemt.github.io' is therefore not allowed access.

I did some search and kind of understand it is related to Cross-Origin Resource Sharing. But I have no idea where this value 'https://s.codepen.io' is coming from and can’t find out how to solve this issue.
Am I missing something?

My GitHub Page (not working): https://sidemt.github.io/random-quote/
GitHub Repository: https://github.com/sidemt/random-quote
Original CodePen (working): https://codepen.io/sidemt/pen/jZrPJO

Line 50 of your index.js file is:

    var shareUrl = "https://codepen.io/sidemt/full/jZrPJO/";

Thank you for your prompt response!

I changed it, but it’s still not working.:pensive:
It is a URL to be included in the tweet, and I guess it does not affect the behaviour of JavaScript.

That just happened to be the first line of code where I saw codepen.io referenced. I suggest doing a search through your code to find other instances.

Yes, sorry for the confusion. I had done the search and had tried changing it locally, but didn’t have the change pushed to the GitHub.

I have reviewed my code several times but I can’t think of any other possible solutions. So I would appreciate any suggestions.

Solved it! It started working by clearing the cache of my browser :joy:

Ummm… but now it does not work on CodePen… :pensive: I’m getting the opposite error:

Failed to load https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=10&callback=: The 'Access-Control-Allow-Origin' header has a value 'https://sidemt.github.io' that is not equal to the supplied origin. Origin 'https://s.codepen.io' is therefore not allowed access.