QuoteMachine: Mixed Content Error


#1

I am using the forismatic API to retrieve the Quotes. When I test my code on notepad, the code runs correctly. However, when I try the code on code pen I get a Mixed content Error. My code on codepen is here: https://codepen.io/Ag_Yog/pen/rzezYw.

When using inspect element I get these errors:

Thanks for any help


#2

Use https for your Forismatic URL to fix this error:

  function getNewQuote(){
    $.ajax({
      url: 'https://api.forismatic.com/api/1.0/', // HTTPS prevents mixed-content

#3

This is because your are requesting resource from an unsecured/remote domain.

if @SkyC method does not work, try using cross origin like this in your request url

"https://crossorigin.me/http://api.forismatic.com/api/1.0/"

I hope that works for you.

read more about cross origin here


#4

CORS is not the same as Mixed Content and neither error is specific to CodePen.

@Ag_Yoge is using JSONP and the API supports HTTPS, so a proxy is not required luckily. These 3rd party proxies like cors-anywhere and crossorigin.me go down frequently and without notice.


#5

hi
What to do here now?
Thanks


#6

This worked for me:

$.getJSON("https://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=?")
  .done(update)
  .fail(handleErr);

Also remember to logon to Codepen using https://codepen.io


#7

I m stuck on color change page. nothing is working out there. can u please help me?


#8

Unfortunately I had no need for a colour change page in my project, so perhaps somebody else can help you. (I assume you are referring to the Random Quote project?)

Please look at some of the other forums as well.

Was your ‘Mixed Content Error’ resolved?