【发布时间】:2017-07-23 21:09:35
【问题描述】:
我还没有找到正确答案。我有一个脚本,我们称它为http://www.example.com/testing.js,我在几个提供 HTTP 服务的站点上使用了它。现在我有两个使用 HTTPS 服务的新站点,当我添加文件 <script src="http://www.example.com/testing.js"></script> 时,出现以下错误
Mixed Content: The page at 'https://location.mysite.com/my-account' was loaded over HTTPS, but requested an insecure script 'http://www.example.com/testing.js'.
此请求已被阻止;内容必须通过 HTTPS 提供。
我想在HTTPS 和HTTP 上使用相同的文件,我需要更改或添加到我的javascript 中以同时为它们提供服务吗?
【问题讨论】:
-
你无法解决这个问题。这取决于浏览器,您无法控制
-
您需要为提供文件的 url 添加一个 ssl。
标签: javascript php html http https