Why my Quote Machine doesn't work in github pages?

Why my Quote Machine doesn't work in github pages?
0

#1

Hi,
I would like to hear from you guys How do you like my project?

But I dont’t understand why doesn’t work in github pages,

https://melissa160.github.io/Developer-Quotes/

If someone knows why this project doesn’t work in github pages please let me know. :blush:

Thanks…


#2

I tried this https://codepen.io/melissa160/full/woeePB/ and it stopped working, so it’s probably because of https. Read your API documentation, they maybe mention that.


#3

Thanks, It’s strange, sometimes works other times no. The API documentation doesn’t mention about https:
http://quotes.stormconsultancy.co.uk/api
Do you recommend me change the API?

Thanks a lot!


#4

As @svmi3195 noted it’s because of https.

GitHub Pages are served via HTTPS, but your code is making request via HTTP and due to security reasons such requests are blocked by browser. You can open browser console (Ctrl + Shift + J) and see the message yourself.


There is a workaround - you can add https://crossorigin.me/ in front of your API call url, like this:

'https://crossorigin.me/http://quotes.stormconsultancy.co.uk/quotes.json'

but lately the crossorigin.me server is very often down, so I wouldn’t count on it.


Btw, here is link to your API endpoint with https: https://quotes.stormconsultancy.co.uk/quotes.json, click it and check how it works via https (spoiler: it doesn’t)