如何修复“阻止加载混合活动内容"用于通过 https 的 css 和 js [英] How to fix "Blocked loading mixed active content" for css and js over https

查看:87
本文介绍了如何修复“阻止加载混合活动内容"用于通过 https 的 css 和 js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试通过 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"[了解更多]

Blocked loading mixed active content "http://www.example.com/style.css"[Learn More]

我可以在页面上查看源代码并搜索http://",但页面上的任何地方都没有结果.

I can do a view source on the page and search for "http://" and there are no results anywhere on the page.

有什么想法吗?

推荐答案

我认为你可以尝试使用相关协议调用者.

I think that you can try with relative protocol caller.

<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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆