为什么所有内容都是https时会出现混合内容错误?

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

我正在尝试使用 iframe 从我的另一个站点加载内容,但在 chrome 中出现混合内容错误。 //https:// 都会产生相同的错误。

iframe:

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

函数

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"
  }
}

我也测试了一个只有 src 标签的普通 iframe,但问题仍然存在。

谷歌搜索我的问题只会导致正常的混合内容错误(尝试在 https 页面上使用 http)

附加说明:我在两个站点上都使用 Cloudflare。我试图在查询中使用 Cloudflare 搜索我的问题,但只找到了类似的结果(与我在没有 Cloudflare 的情况下用谷歌搜索问题时的结果相似)

CheckFrame() 中,您将源设置为:

f.src = "http://mc.skylinemc.us/~aiden/bans"

这不是 https 并解释了您收到错误的原因。只需更改

src

开始
https://

已找到修复方法!

原来我需要在 url 的末尾添加 index.php