开发者

Hosting your own JavaScript scripts files (other than Jquery) on fast free CDNs like google? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. 开发者_JS百科

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 4 years ago.

Improve this question

Inspired by Dave Ward to host javascript files externally, I have several questions concerning the hosting of Javascript files externally:

Everybody knows that known libraries can be directly sources to, for free:

//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js
//ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js

The scope of this question however focuses to hosting custom javascript files externally:

Q1. Is it possible to host private JavaScript files on a fast free public CDN?

Q2. Are there any speed penalties or is hosting on third party CDN practically always better?

Q3. Are there any safety risks involved in hosting custom JavaScript files externally?


Thanks to 13 people who have favorited this question, I am reopening this question! As of 2021, lightning fast websites (with all their JavaScript components) its more important than ever before to gather a collaborative understanding of objective ways to speed up page load. Untill this question is reopened, feel free to comment below your answer/suggestions to the three questions!


jsdelivr is a free, fast and reliable service to host your javascript files on a CDN.
The file should be on github repository first, then use the following format to use the CDN:-

https://cdn.jsdelivr.net/gh/user/repo@version/file

In the above format replace user with your username on github, repo with repository name and version with the version of your repository
You can use this CDN service for hosted anywhere like npmjs.com or even on your wordpress sites using their plugin.
Please visit the website for more information and to know how it works.


EDIT: as of 2021-07-10 this feature doesn't work at codepen anymore.


codepen.io allows you to host some js files without registration. Once you have an anonymous codepen saved the js part of it is available by just adding a .js at the end of your url.


I'm using http://yourjavascript.com for 3 years and happy with their free service.


You can use CoralCDN which is a free cdn. It is unlikely to be as fast as Google's but it's free!


If your script is hosted on Github or NPM, I would suggest jsDelivr. It even allows you to target a specific version, or minify your scripts.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜