Link and execute external JavaScript file hosted on GitHub

前端 未结 15 869
感动是毒
感动是毒 2020-11-22 04:08

When I try to change the linked reference of a local JavaScript file to a GitHub raw version my test file stops working. The error is:

Refused to exe

15条回答
  •  心在旅途
    2020-11-22 04:36

    When a file is uploaded to github you can use it as external source or free hosting. Troy Alford has explained it well above. But to make it easier let me tell you some easy steps then you can use a github raw file in your site:

    Here is your file's link:

    https://raw.githubusercontent.com/mindmup/bootstrap-wysiwyg/master/bootstrap-wysiwyg.js

    Now to execute it you have to remove https:// and the dot( . ) between raw and githubusercontent

    Like this:

    rawgithubusercontent.com/mindmup/bootstrap-wysiwyg/master/bootstrap-wysiwyg.js

    Now when you will visit this link you will get a link that can be used to call your javascript:

    Here is the final link:

    https://rawgit.com/mindmup/bootstrap-wysiwyg/master/bootstrap-wysiwyg.js

    Similarly if you host a css file you have to do it as mentioned above. It is the easiest way to get simple link to call your external css or javascript file hosted on github.

    I hope this is helpful.

    Referance URL: http://101helper.blogspot.com/2015/11/store-blogger-codes-on-github-boost-blogger-speed.html

提交回复
热议问题