Google与微软为jQuery等类库提供CDN服务

5 篇文章 0 订阅
3 篇文章 0 订阅

以前在网站中都是这么引入jquery脚本库的:

< script type="text/javascript" src="/Comm/jQuery.min.js">< /script>

有时还要引入其它比较大的脚本类库,如:Prototype,每次引入时都得考虑:这么大的东西客户打开网页时要多郁闷啊。

现在好了,Google与Microsoft为jQuery,Prototype,MooTools等类库提供CDN服务,这样一来,不在客户在哪访问网站都是通过CDN访问这些脚本,提高了加载速度,减少了加载延迟并获得更好的缓存。
如:

< script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">< /script>
推荐大家使用


相关链接:

Google:  http://code.google.com/apis/ajaxlibs/
Microsoft:  http://www.asp.net/ajaxlibrary/cdn.ashx

Google提供的API最多,常用的他全有,像flash: swfobject

下载 jQuery

共有两个版本的 jQuery 可供下载:一份是精简过的,另一份是未压缩的(供调试或阅读)。

这两个版本都可从 jQuery.com 下载。

CDN HOSTED JQUERY

A number of large enterprises provide hosted copies of jQuery on existing CDN networks that are available for public use. Below are links to the CDN-hosted copies of jQuery that you may hotlink to.

库的替代

Google 和 Microsoft 对 jQuery 的支持都很好。

如果您不愿意在自己的计算机上存放 jQuery 库,那么可以从 Google 或 Microsoft 加载 CDN jQuery 核心文件。

使用 Google 的 CDN

<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs
/jquery/1.4.0/jquery.min.js"></script>
</head>

使用 Microsoft 的 CDN

<head>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery
/jquery-1.4.min.js"></script>
</head>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值