开发者

Google CDN for JS - where are the direct paths?

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 cod开发者_开发百科e 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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜