适用于JS的Google CDN - 直接路径在哪里?

时间:2011-07-15 04:07:44

标签: jquery jquery-ui google-cdn

http://code.google.com/apis/libraries/devguide.html

我不想使用Google的API密钥来使用Google的加载程序加载各种JS库(因为密钥似乎与某个域绑定,而我正在尝试编写1个代码来处理多个域)。

在谷歌的介绍中,它说:

  

您的应用程序可以使用我们非常灵活的加载器google.load()或   直接的,基于路径的脚本访问。

这些“基于路径的直接访问脚本在哪里?”

此外,我想我还记得有一个链接来获取最新版本的脚本而无需指定版本号。

2 个答案:

答案 0 :(得分:2)

您可以在http://code.google.com/apis/libraries/devguide.html找到它们。通常,除非您希望在版本更改和使用的API发生更改时在应用程序中出现奇怪的随机故障,否则最好不要使用最新链接。

答案 1 :(得分:0)

增加什么刺激说。在您提供的链接中,只需查看路径和路径(u) 它没有突出显示,这就是为什么你没有看到它。

实施例

jQuery  
   name: jquery  
   latest version: 1.6.2 (view older versions)  
   load request: google.load("jquery", "1.6.2");  
   extras: uncompressed:true (as in google.load("jquery", "1.6.2", {uncompressed:true});  
   path: https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js  
   path(u): https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js  
   site: http://jquery.com/  
   note: 1.2.5 and 1.2.4 are not hosted due to their short and unstable lives in the wild...  

另外,对于获取最新版本,您可以这样做。

  // You may specify partial version numbers, such as "1" or "1.3",  
  //  with the same result. Doing so will automatically load the   
  //  latest version matching that partial revision pattern   
  //  (e.g. 1.3 would load 1.3.2 today and 1 would load 1.6.2)

试试这些链接

https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js
https://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.js

还请这样链接。

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

使用protocol- less 引用的原因:Cripple the Google CDN’s caching with a single character