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