首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Javascript模块未出现在通过CS50集成开发环境托管的网站中

Javascript模块未出现在通过CS50集成开发环境托管的网站中
EN

Stack Overflow用户
提问于 2019-01-04 05:51:00
回答 1查看 166关注 0票数 0

我正在做我的课程期末项目,并努力弄清楚我在cal-heatmap上遇到的一个bug,这是一个Javascript库,可以创建热图,比如Github的贡献日历。

当我在电脑上创建一个HTML文件并在Chrome中打开它时,一切看起来都很完美。

Perfect

当我在Apache中创建相同的CS50文件,并在通过Flask/Apache托管服务器后打开它时,它看起来并不完美。

Not perfect

这是代码,sourced from this tutorial

代码语言:javascript
复制
    <!DOCTYPE html>  
<html lang="en">  

<head>  
    <title>Cal-Heatmap Samples</title>  
    <meta charset="utf-8">  
    <meta name="viewport" content="width=device-width, initial-scale=1">  
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">  
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>  
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>  
    <script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>  
    <script type="text/javascript" src="http://cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.min.js"></script>  
    <link rel="stylesheet" href="http://cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.css" />  
</head>  

<body>  
    <div class="container">  
        <div class="page-header">  
            <h2>  
Cal-HeatMap Samples</h2>  
        </div>  
        <div class="row">  
            <div class="col-lg-6">  
                <div class="panel panel-default">  
                    <div class="panel-heading"><span class="glyphicon glyphicon-equalizer"></span> Service Call Statistics</div>  
                    <div class="panel-body">  
                        <div id="heatmap-navigation">  
                            <button id="heatmap-previous" style="margin-bottom: 5px;" class="btn-xs"><i class="glyphicon glyphicon-chevron-left"></i></button>  
                            <button id="heatmap-next" style="margin-bottom: 5px;" class="btn-xs"><i class="glyphicon glyphicon-chevron-right"></i></button>  
                        </div>  
                        <div id="cal-heatmap">  
                        </div>  
                    </div>  
                </div>  
            </div>  
        </div>  


        <script type="text/javascript">  
            var cal = new CalHeatMap();  
            cal.init({  
                domain: "month",  
                subDomain: "day",  
                cellSize: 20,  
                itemName: ["service ticket", "service tickets"],  
                data: {  
                    "1452019700": 40,  
                    "1454688100": 50,  
                    "1452710900": 5,  
                    "1452883700": 15,  
                    "1453142900": 15,  
                    "1453488500": 30,  
                    "1456239700": 80,  
                    "1453662300": 20,  
                    "1455130100": 60,  
                    "1455562100": 70,  
                    "1455131100": 10,  
                    "1456166900": 30,  
                    "1456399000": 12,  
                    "1451674100": 90  
                },  
                subDomainTextFormat: "%d",  
                range: 3,  
                displayLegend: true,  
                domainMargin: 20,  
                animationDuration: 800,  
                domainDynamicDimension: false,  
                start: new Date(2016, 01, 01),  
                end: new Date(2016, 02, 26),  
                scale: [10, 20, 80],  
                previousSelector: "#heatmap-previous",  
                nextSelector: "#heatmap-next",  
            });  
        </script>  
</body>  

</html>

怎么回事?为什么相同的代码会得到不同的结果?

谢谢你的帮忙!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-04 09:06:34

菲克斯,我真想亲你!

作为一个业余爱好者,我显然没有窥探Chrome控制台的习惯。当我在你的命令下这么做的时候,问题就像水晶一样清晰:

Cloud9 (CS50的基于云的集成开发环境)不能让你链接到只遵循超文本传输协议而不是超文本传输协议的资源。

Before

After

我修复了这个问题,将前面提供的代码中的所有"http://“”替换为"https://"“。

谢谢,谢谢!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54030298

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档