Search code examples
htmliframehttpsmixed-content

Why is there a mixed content error when all content is https?


I am attempting to use an iframe to load content from another one of my sites, but get a mixed content error in chrome. Both // and https:// yield the same error.

Iframe:

<iframe src='https://ajg0702.us/bans' id='frame' frameBorder="0" onload='checkFrame()'>Please update your browser.</iframe>

The function

function checkFrame() {
  var f = document.getElementById('frame');
  if(f.src != "//ajg0702.us/bans" & f.src != "https://ajg0702.us/bans" & f.src != "http://astrophoenix.com/~aiden/bans") {
    console.log("Fallback webpage! current: " + f.src)
    //Will load backup page if main page gets redirected somewhere else
    f.src = "http://mc.skylinemc.us/~aiden/bans"
  }
}

I also tested a plain iframe with only the src tag, and the problem persisted.

Googling my issue has only lead to normal mixed content errors (attempting to use http on https page)

Additional note: I am using Cloudflare on both sites. I attempted to search my problem with Cloudflare in the query, but only found similar results (to when I googled the problem without Cloudflare)


Solution

  • Found a fix!

    Turns out I needed to add index.php to the end of the url.