通过https加载样式表时出现问题 [英] Problems loading style sheets over https

查看:474
本文介绍了通过https加载样式表时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将SSL证书应用于我的域名,但在http://上查看我的网站时遇到了一些样式问题,但通过https://查看时,样式没有问题,则不应用任何样式总之,我发现问题是什么,我没有通过https加载我的第三方样式,而是他们是http,切换到https,所有问题都得到了解决。

方案

您可能使用 http:// 链接指向 https:// 网站。

安全网站不允许混合协议。 必须从安全服务器中嵌入。浏览器将忽略/阻止HTTPS页面上的HTTP资源(具有不同程度的严格性)。



此阻止的原因是样式表和脚本等不安全的HTTP资源仍然可能



如果样式表由您的服务器提供,然后省略URL的协议+主机部分,即代替 http://example.com/style.css 使用 /style.css 作为URL,所以它将同时在HTTP和HTTPS上运行。您还可以使用协议相关网址



如果您必须拥有一个完整网址,请仅使用 https:// ... 网址。


I recently applied an SSL certificate to my domain but I'm having problems with some of the styles when viewing my website on http:// the styles are fine but when viewing it through https:// then no styles are applied at all, I found out what the problem was I wasn't loading my thirdparty styles through https instead they were http, switched to https all problems were solved.

解决方案

You're probably using an http:// link to a stylesheet on an https:// website.

Secure websites are not allowed to mix protocols. Everything has to be embedded from a secure server. Browsers will ignore/block HTTP resources on HTTPS pages (with varying degree of strictness).

The reason for this blocking is that insecure HTTP resources like stylesheets and scripts could still be modified by an attacker and used to spoof/hijack secure parts of the site.

If the stylesheet is served from your server, then omit protocol+host part of the URL, i.e. instead of http://example.com/style.css use /style.css as the URL, so it'll work on both HTTP and HTTPS. You can also use protocol-relative URLs.

If you have to have one full URL, then use https://… URLs only.

这篇关于通过https加载样式表时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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