jquery,extjs,bootstrap等成熟的框架库,让我们的开发更加容易,但是这些库本身动则上百K,有时要加载好几个文件,为了减轻服务器负担,减少前端响应时间,我们可以通过几家知名网站提供的CDN。
Bootstrap官方CDN
Optional:
微软公共资源CDN
微软为了方面其开发者使用,也开通了丰富的公共库的CDN。地址为:http://www.asp.net/ajaxlibrary/CDN.ashx
主要的资源有:
ajax.microsoft.com renamed to ajax.aspnetcdn.com
Visual Studio .vsdoc Support
Using ASP.NET Ajax from the CDN
Using jQuery from the CDN
Using jQuery UI from the CDN
Third-Party Files on the CDN
jQuery Releases on the CDN
jQuery Migrate Releases on the CDN
jQuery UI Releases on the CDN
jQuery Validation Releases on the CDN
jQuery Mobile Releases on the CDN
jQuery Templates Releases on the CDN
jQuery Cycle Releases on the CDN
jQuery DataTables Releases on the CDN
Modernizr Releases on the CDN
Ajax Control Toolkit Releases on the CDN
JSHint Releases on the CDN
Knockout Releases on the CDN
Globalize Releases on the CDN
ASP.NET Web Forms and Ajax Releases on the CDN
ASP.NET MVC Releases on the CDN
ASP.NET SignalR Releases on the CDN
百度CDN公共库
CDN公共库是指将常用的JS库存放在CDN节点,以方便广大开发者直接调用。与将JS库存放在服务器单机上相比,CDN公共库更加稳定、高速。 百度公共CDN为您的应用程序提供稳定、可靠、高速的服务,包含全球所有最流行的开源JavaScript库。地址:http://developer.baidu.com/wiki/index.php?title=docs/cplat/libs
CDN资源有:
- 2.1 backbone
- 2.2 Bootstrap
- 2.3 dojo
- 2.4 ext-core
- 2.5 Highcharts
- 2.6 Highstock
- 2.7 jqMobi
- 2.8 jQuery
- 2.9 jQuerymobile
- 2.10 jQuerytools
- 2.11 jQueryui
- 2.12 JSON
- 2.13 lesscss
- 2.14 mootools
- 2.15 prototype
- 2.16 QUnit
- 2.17 scriptaculous
- 2.18 swfobject
- 2.19 UNDERSCORE
- 2.20 webfont
- 2.21 yui
- 2.22 zepto
新浪公共资源CDN
公共资源包含Jquery、 Mootools、 Prototype、YUI等通用JS/CSS Framework;您可以通过地址直接引用。公共资源前端采用CDN技术,节点分布在全国各地;用户可以就近取得资源内容, 提升您的应用速度。
详细资源请访问:http://sae.sina.com.cn/?m=devcenter&catId=147
其它
类似jquery这种开源代码均可在code.google.com或gitHub上找到相关CDN链接
如jquery在code.google.com上的连接是://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js
使用方法
以下是别人写的使用新浪cdn加速库的方法,仅供参考:
<script src="//http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script>
<script>
if (!window.jQuery) {
var script = document.createElement('script');
script.src = "/js/jquery.min.js";
document.body.appendChild(script);
}
</script>