【发布时间】:2015-08-20 05:34:04
【问题描述】:
我有这个问题。在外部网站我有一个这样的脚本:
<div id="idtest"></div>
<script src="//example.com/widget.js" type="text/javascript"></script>
example.com 位于 https 中(同时允许 http 和 https)。在脚本 widget.js 的服务器中,我有:
$('#idtest').load("https://example.com/index.html")
我收到此错误:混合内容:“thepage”处的页面是通过 HTTPS 加载的,但请求了不安全的 XMLHttpRequest 端点“http://example.com/index.html”。此请求已被阻止;内容必须通过 HTTPS 提供。
我不明白:为什么会出现错误以及为什么端点在“http”中? 谢谢
编辑
更多信息:
如果在 widget.js 中我这样做:
$('#idtest').load("./index.html")
如果我在我的站点中加载脚本,内容已加载并且一切正常。
如果我这样做:
x = "https://example.com"
$('#idtest').load(x + "/index.html")
或
$('#idtest').load("https://example.com/index.html")
我收到错误消息(如果我将脚本放在我的站点或外部站点中)。为什么?
编辑 2
更多信息:
我的网站在 django 中
编辑 3
在 Firefox 中,我以 https 和 http 加载页面。它在 Chrome 中不起作用。我在调用 url 时在 Firefox 网络分析器中看到了这种情况:
302https://example.com/index.html 200http://example.com/index.html[混合内容]
这种情况怎么理解(https转http)?可能是 Django 重定向问题?
【问题讨论】:
-
对不起,不起作用
-
您是否检查过所请求的整个页面是否使用了https?你确定 index.html 上没有任何东西链接到不安全的东西吗?
-
是的,我确定在 idex.html 中没有 http 链接
标签: javascript jquery http https