简体   繁体   English

字体和字体真棒图标无法通过SSL加载

[英]Fonts and Font Awesome icons not loading over SSL

I'm trying to get my website to load correctly over SSL, and every time I view the page, the icons and font aren't loading. 我正在尝试通过SSL正确加载我的网站,每次查看页面时,图标和字体都没有加载。

Here's what I'm using for my CSS and font awesome. 这是我正在使用的CSS和字体真棒。

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.min.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600' rel='stylesheet' type='text/css'>

Here's a link to the website in case you want to check the full code 如果您想查看完整代码,请访问以下网站链接

Try remove http: from href : 尝试从href删除http:

<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

There is a great article about protocol-relative here: paulirish.com/2010/the-protocol-relative-url/ 这里有一篇关于协议相关的好文章: paulirish.com/2010/the-protocol-relative-url/

I had the same SSL/TLS error/issue over the chrome. 我在Chrome上遇到了相同的SSL / TLS错误/问题。 It worked OK on the firefox. 它在firefox上运行正常。 I had to switch the sources. 我不得不切换来源。

There is issue with MaxCDN you need to use KeyCDN. MaxCDN存在问题,您需要使用KeyCDN。

Switch from: 切换自:

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>

to: 至:

<link href="https://opensource.keycdn.com/fontawesome/4.7.0/font-awesome.min.css" rel="stylesheet"/>

Try using 尝试使用

//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css

and maybe its a simple issue of using "http" instead "https" because the google apis use https for secure link transfer. 也许这是一个使用“http”代替“https”的简单问题,因为谷歌apis使用https进行安全链接转移。 Replace http with https 用https替换http

In my case change http source to https while using @import statement in css file works fine. 在我的情况下,在css文件中使用@import语句时将http源更改为https工作正常。

@import url(https://opensource.keycdn.com/fontawesome/4.7.0/font-awesome.min.css);
[class*="fontawesome-"]:before {font-family: 'fontawesome', sans-serif;}

Try downloading the font-awesome zip (css & assets) and serve them from your own server/directory - instead of using the CDN links. 尝试下载font-awesome zip(css&assets)并从您自己的服务器/目录中提供它们 - 而不是使用CDN链接。

Then just refer to the font-awesome css file in your own directory using https:// 然后使用https://在您自己的目录中引用font-awesome css文件

This worked for me. 这对我有用。

I assume your webbrowser blocked the HTTP resources from being loaded from a Server that is configured for HTTPS, which is referred to as "Mixed Content", and is flagged as a security risk. 我假设您的webbrowser阻止HTTP资源从配置为HTTPS的服务器加载,该服务器被称为“混合内容”,并被标记为安全风险。

A secure site should never load resources via a non-secure mechanism. 安全站点永远不应该通过非安全机制加载资源。

Perhaps your webbrowser auto-updated to a newer version that does not allow Mixed Content to the loaded. 也许您的webbrowser会自动更新为不允许混合内容加载的新版本。

What is Mixed Content? 什么是混合内容? - Google Developers - Google Developers

I had this same problem - after lots of attempts using the CDN links, with and without https://.. , I decided to download the font-awesome zip file and serve them instead from my own server. 我有同样的问题 - 经过大量尝试使用CDN链接,无论有没有https://.. ,我决定下载字体真棒的zip文件,并从我自己的服务器上提供它们。

Put all the css and assets on your own server, instead of loading them from the CDN link with https://.. 将所有cssassets放在您自己的服务器上,而不是使用https://..从CDN链接加载它们https://..

Then, just refer to font-awesome.css file using https://.. 然后,使用https://来引用font-awesome.css文件。

Eg: 例如:

<link rel="stylesheet" href="https://yourdomain-name.com/assets/font-awesome-4.7.0/css/font-awesome.min.css">

This fixed it for me, after going round in circles. 在围成一圈之后,这为我修好了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM