Google CDN for JS - 直接路径在哪里?

发布于 2024-11-24 20:51:38 字数 419 浏览 3 评论 0原文

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

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

在谷歌的介绍中,它说:

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

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

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

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

I don't want to use Google's API key to load the various JS libraries using Google's loader (as the key seems to be tied to a certain domain and I'm trying to write 1 code to work on multiple domains).

In Google's introduction, it says:

Your application can use our very flexible loader google.load() or
direct, path-based access to the scripts.

Where are these "direct, path-based access to the scripts?"

Also, I think I also remember there being a link to get the latest version of a script without having to specify the version number.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

迷荒 2024-12-01 20:51:38

您可以在 http://code.google.com/apis/libraries/devguide 上找到它们。 html。一般来说,链接到最新版本并不是一个好主意,除非您希望在版本更改和您使用的 API 发生更改时在应用程序中出现奇怪的随机故障。

You can find them on http://code.google.com/apis/libraries/devguide.html. Generally it isn't a good idea to link against latest unless you want to have weird random failures in your application when the version changes and an API you were using changes.

深巷少女 2024-12-01 20:51:38

添加到 stimms 所说的内容。在您提供的链接中,只需查看路径和路径(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>

使用无协议参考的原因:用单个字符削弱 Google CDN 的缓存

Adding to what stimms said. In the link you have provided just look at the path and path(u).
Its not highlighted and thats why you don't see it.

Example

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...  

Also for fetching the latest versions, you could do this.

  // 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)

Try these links

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

And also please link like this.

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

Reason for using protocol-less reference: Cripple the Google CDN’s caching with a single character

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文