为什么这个Google字体不起作用?

时间:2015-06-09 12:03:27

标签: html css ssl google-font-api

在我的标签上有这一行,并且在Apache下的Debian服务器上正常工作,但是当我将它上传到我的生产服务器(也是Apache的Debian)时,我无法获得Open Sans Condensed字体。

<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:700,300,300italic' rel='stylesheet' type='text/css'>

以下是整个:

<head>
    <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
        <title> XLS and CSV Conversor</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
    <meta name=viewport content="width=device-width, initial-scale=1.0, minimum-scale=0.5 maximum-scale=1.0">
    <meta name="viewport" content="target-densitydpi=device-dpi">
        <meta name="description" content="Conversor CSV">
        <meta name="keywords" content="conversor CSV, conversor, CSV">
        <link rel="stylesheet" type="text/css" href="style/style.css" />
        <script src="style/sweet_alert/sweetalert.min.js"></script>
    <link rel="stylesheet" type="text/css" href="style/sweet_alert/sweetalert.css">
        <script src="js/jquery-1.11.2.min.js" type="text/javascript"></script>
        <script type="text/javascript" src="js/progressbar.js"></script>
        <script type="text/javascript" src="js/textareascript.js"></script>

        <script type="text/javascript" src="js/modernizr.custom.04022.js"></script>
        <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:700,300,300italic' rel='stylesheet' type='text/css'>
        <!--[if lt IE 9]>
            <style>
                .content{
                    height: auto;
                    margin: 0;
                }
                .content div {
                    position: relative;
                }
            </style>
        <![endif]-->

         <!--[if lt IE 9]>
            <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
         <![endif]-->
    </head>

有人可以告诉我为什么吗?谢谢。

1 个答案:

答案 0 :(得分:3)

如果您使用的是SSL,则无法调用未加密的Google字体版本。要修复此问题,请在HTML页面(或模板)上找到此行:

<link href='http://fonts.googleapis.com/css?family=Whatever:400,600' rel='stylesheet' type='text/css'>

并将其更改为:

<link href='//fonts.googleapis.com/css?family=Whatever:400,600' rel='stylesheet' type='text/css'>

这将允许浏览器选择适当的页面。