如何解决“阻止加载混合活动内容”通过https访问css和js [英] How to fix "Blocked loading mixed active content" for css and js over https
问题描述
当试图通过https查看我的网站时,我一直在我的Firefox控制台中收到阻止加载混合活动内容错误。我得到这个错误只为我的css和js文件。
When attempting to view my site over https, I keep getting a "Blocked loading mixed active content" error in my Firefox console. I am getting this error only for my css and js file.
我很困惑的原因是因为对页面代码本身的文件的引用是https:
The reason I am so confused is because the reference to the files in the page code itself is https:
<link rel="stylesheet" href="https://www.example.com/style.css">
但在控制台中,它显示为http:
But in the console, it shows it as http:
阻止加载混合活动内容 http://www.example .com / style.css [了解更多信息]
我可以在页面上查看源代码并搜索http://,页面上的任何地方都没有结果。
I can do a view source on the page and search for "http://" and there are no results anywhere on the page.
有什么想法?
Any ideas?
推荐答案
I think that you can try with relative protocol caller.
样式表href =// www.example.com/style.css\">
--------- ^^
<link rel="stylesheet" href="//www.example.com/style.css">
---------^^
如果您的用户访问您的网页在http中,它加载http,如果用户在https下访问,则加载https。
if your users visit your web in http, it loads http, and if the user visit under https it loads https.
这篇关于如何解决“阻止加载混合活动内容”通过https访问css和js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!