文档中心 CDN Pro 网站案例:外链引用方式

网站案例:外链引用方式

更新时间:2022-07-18 19:42:54

网站实现案例:第三方外链引入方式

Google Analytics

## 在 HTML 的 <body> 部分插入了如下谷歌分析跟踪JS脚本。

<body class="zh">
……
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
        
        gtag('config', 'G-XXXXXXXXXX');
    </script>
……
</body>

百度统计

## 在 HTML 的 <head> 部分插入了如下百度统计埋点JS脚本:

<head>
……
    <script>
        var _hmt = _hmt || [];
        (function() {
          var hm = document.createElement("script");
          hm.src = "https://hm.baidu.com/hm.js?XXXXXXXXXX";

          var s = document.getElementsByTagName("script")[0]; 
          s.parentNode.insertBefore(hm, s);
        })();
    </script>
……
</head>

Google Fonts

## 在 HTML 的 <head> 部分引入谷歌字体API:

## <!-1. 添加样式表链接以请求所需的网络字体->
    <link rel="stylesheet"
        href="https://fonts.googleapis.com/css?family=Swanky+and+Moo+Moo|Meie+Script">

## <!-2.使用请求的网络字体设置CSS样式->
     .css-selector {
     font-family: 'Swanky+and+Moo+Moo|Meie+Script', serif;
     }

## 其中,从谷歌字体API返回的 CSS 会加载实际的字体文件的外链:

     /* latin-ext */
     @font-face {
           font-family: 'Meie Script';
           font-style: normal;
            font-weight: 400;
           src: url(https://fonts.gstatic.com/s/meiescript/v21/_XXXXXXXXXX1.woff2) format('woff2');
           unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
     }
      /* latin */
     @font-face {
           font-family: 'Meie Script';
           font-style: normal;
           font-weight: 400;
           src: url(https://fonts.gstatic.com/s/meiescript/v21/_XXXXXXXXXX2.woff2) format('woff2');
           unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
     }
     /* latin */
     @font-face {
           font-family: 'Swanky and Moo Moo';
           font-style: normal;
           font-weight: 400;
           src: url(https://fonts.gstatic.com/s/swankyandmoomoo/v22/_XXXXXXXXXX3.woff2) format('woff2');
           unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
     }

Youtube

## 在 HTML 的 <body> 部分的<iframe>标签下引入Youtube视频链接:

<head>
     <meta charset="UTF-8">
     <title>video</title>
 </head>
     <body>
     <iframe src="//player.Youtube.com/player.html?aid=XXX&cid=XXX&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" width="500" height="500"> </iframe>
</body>

本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!