Quote Machine not running off of Codepen

Quote Machine not running off of Codepen
0

#1

Hey, all.

I got my Random Quote Machine running on Codepen just fine, but when I try to run the same code off of Codepen it doesn’t get the quotes. Maybe it’s something to do with the API, but I’ll be darned if I can figure out what it is exactly. Does anyone have any ideas?

My codepen: Link

The same code on github: [Link]https://crowsveldt.github.io/

Thanks in advance to anyone who reads this


#2

Well, I messed up showing the github link, but you get the idea. Here is is so no one has to copy/paste:link


#3

Hi,

its a cross domain issue. Your api is http, which is why it works on non secured codepen, but then the call will get rejected because github is https. You can either keep it on codepen, use a custom domain with github and lose the https across all your github sites or search the forum - there is a thread dedicated to CORS and cross domain issues.

Cheers

Mark

EDIT: also, if you look in your browsers developers tools, and choose console view, you can see the error when you click for a quote.


#4

Thanks! I thought it was probably something simple and well known, but I couldn’t figure ti out :slight_smile:


#5

Yes, i think every single camper has run into this issue :smile:


#6

Yeah, I read about it back when I was first working on the app, but it went over my head and I guess I forgot about it. Now I’m pushing all of my projects to Github so I get to see all the ugly wonky things I did. :sweat: