如何将Tangle.js作为外部资源添加到jsfiddle

时间:2016-06-13 17:08:55

标签: javascript jsfiddle

尝试将Tangle.js库添加到jsfiddle并且它无法正常工作。

小提琴是here

代码是:

   var tangle = new Tangle (document.getElementById("bedroomcostcalculator"), {
    initialize: function () {
        this.bedrooms = 2;
        this.cost = 300000;
        this.costperbedroom = 150000;
        },
update: function () {
        this.cost = this.bedrooms * this.costperbedroom;
       }
});

Tangle的网址是:http://worrydream.com/Tangle/Tangle.js

我们已将网址添加到外部资源,但它没有提取它。我已经看过其他关于需要链接到CDN格式的帖子 - 我们将如何做到这一点?

2 个答案:

答案 0 :(得分:1)

正如您所说,该库的网址为http://worrydream.com/Tangle/Tangle.js,但在您的jsfiddle中,您使用了网址https://worrydream.com/Tangle/Tangle.js(https而不是http)。

第二个链接根本不起作用。

切换到通过HTTP而不是HTTPS加载jsfiddle(将URL更改为http而不是https),然后将Tangle库URL修复为HTTP版本。

答案 1 :(得分:0)

需要通过HTTPS加载外部资源。添加资源时,您会看到以下消息:

popup from JSFiddle when adding insecure resource

您需要找到提供Tangle.js的安全CDN。

相关问题