引用网络jquery(jquery远程引用地址)方式及优点

转自:http://blog.csdn.net/leedaning/article/details/46834007
jQuery 引用地址{包括jquery和google提供的地址}, 节省你不必要的流量
你可以使用这句代码读取jQuery的最新版本的代码文件。

jquery官方的引用地址:

示例:

<script src="http://code.jquery.com/jquery-latest.js">script>

有效地址:

http://code.jquery.com/jquery-1.9.1.min.js
http://code.jquery.com/jquery-1.9.1.js

其中:1.9.1是版本信息,latest: 表示最新。

Google引用地址:

可以使用下面这个代码从ajax.googleapis.com调用同样的最新版本jQuery:

示例:

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

有效地址:

http://ajax.googleapis.com/ajax/libs/jquery/1.9.2/jquery.min.js
http://ajax.googleapis.com/ajax/libs/jquery/1.9.2/jquery.js

其中:1.9.2是版本信息

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js">script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js">script>

如果不放心,担心谷歌和微软强大的CDN有时候会连接不上?那就用这段代码:

<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js">script>
<script>
// Fallback to loading jQuery from a local path if the CDN is unavailable
(window.jQuery || document.write('
                    
                    

你可能感兴趣的:(jquery远程地址,jquery网络资源,引用网络jquery,jquery远程引用)