为什么 Github 页面不允许我的有效 HTML?

Why will Github Pages not allow my valid HTML?

我目前正在 Github 上为 Github 使用 W3Schools 脚本的页面制作回购协议。我的 index.html 代码如下所示:

<!DOCTYPE html>
<html>
    <head>
        <title>[my name] Witness Project</title>
        <script src="http://w3schools.com/lib/w3data.js"></script>
    </head>
    <body>
        <div w3-include-html="common.html"></div>
        <div id="main">
            <h1 style="display:block">This will be my Witness Project soon!</h1>
        </div>
    </body>
    <script>
    w3IncludeHTML();
    </script>
</html>

在common.html中,有页眉和页脚的代码:

<link rel="stylesheet" href="common.css">
<div id="header">
    <nav>
        <button type="button"><a href="index.html">Home</a></button>
        <button type="button"><a href="#">Coming Soon</a></button>
        <button type="button"><a href="#">Coming Soon</a></button>
        <button type="button"><a href="#">Coming Soon</a></button>
        <button type="button"><a href="#">Coming Soon</a></button>
    </nav>
</div>

<div id="footer">
    Created as part of <i>The Witness Project</i> at The Key School<br>
    <i>Content of website © 2016 by [my name]</i>
</div>

我正在使用 here 描述的脚本来导入其他 HTML 文件。我认为 CSS 不相关。但是,当我加载 Github 页面时,我只看到 index.html 中的元素。但这不是我的错,因为当我从本地文件加载页面时,它看起来像我期望的那样。

图片:
在线:
本地: 到底是怎么回事? Github可以不使用外部JS吗?

编辑:我检查了控制台并收到此消息:

您收到的错误 Blocked loading mixed active content "http://w3schools.com/lib/w3data.js" 表示您有 "mixed content" — 也就是说,某些内容是通过 https 加载的,而其他内容是通过 [=12] 不安全地加载的=].

通过 http 加载这样的脚本使其容易在发送者和接收者之间被篡改,因此它被认为是一种安全风险并且(某些)浏览器会阻止它。

当您 link 到脚本时,您可以在没有协议的情况下使用 <script src="//w3schools.com/lib/w3data.js"></script>,脚本将使用用于加载页面的任何协议(http 或 https)加载。这将消除错误。

不幸的是,我测试了 https://w3schools.com/lib/w3data.js 并且它(首先)给了我一个证书错误,然后是 404 ... w3schools 没有通过 https 提供该脚本。
在这种情况下,最好的办法是在本地保存一个副本,然后 link 保存到那个副本而不是 w3schools CDN。