By Sam Deering

Load jQuery with Google Libraries API

By Sam Deering

google load jquery

Usually if you want to use jQuery you need to download the latest package, save the .js file in your js/ folder and then include the link in your page header. This can become time consuming especially when you need to test different versions of jQuery for compatibility with plugins or code you are developing. It also is annoying to keep upgrading to the latest version each time they release a new version (usually every few months or so). Here comes Google to the rescue (once again!) by offering a Library API which can load the latest version (or any version) of pretty much any JavaScript Library going. This saves you downloading them onto your own host each time you use a library. Dynamically Load jQuery Library Using Plain JavaScript.

The Libraries API provides your applications with stable, reliable, high-speed, globally available access to all of the most popular, open-source JavaScript libraries. Your application can use our very flexible loader google.load() or direct, path-based access to the scripts.

Using Google API to Dynamically Load jQuery

Step 1 Get your Google API key

Step 2 Put this code in your header:

Step 3 Put this code in your header:

Or you can use a direct link:

No Strings attached Include, Latest Versions


See how to fall back to your own local jQuery package if the Google one doesn’t load (not likely).

Tip: You can use google.load(“jquery”, “1”);  to automatically load the latest version of jQuery.

The jQuery package details

name: jquery
latest version: 1.6.1 (view older versions)1.2.3, 1.2.6, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1, 1.4.2
load request: google.load(“jquery”, “1.6.1”);
extras: uncompressed:true (as in google.load(“jquery”, “1.6.1”, {uncompressed:true});
note: 1.2.5 and 1.2.4 are not hosted due to their short and unstable lives in the wild…

Other supported Libraries in the Google API

google.load("chrome-frame", "1.0.2"); 
  google.load("dojo", "1.5"); 
  google.load("ext-core", "3.1.0"); 
  google.load("jquery", "1.6.1"); 
  google.load("jqueryui", "1.8.6"); 
  google.load("mootools", "1.3.0"); 
  google.load("prototype", ""); 
  google.load("scriptaculous", "1.8.3"); 
  google.load("swfobject", "2.2"); 
  google.load("yui", "2.8.2"); 
  google.load("webfont", "1.0.15");
  • You’re welcome ;)

  • There is obviously a lot to know about this. I think you made some good points in Features also.
    Keep working ,great job!

  • Thanks for taking the time to share this, I feel strongly about it and love reading more on this topic. If possible, as you gain knowledge, would you mind updating your blog with more information? It is extremely helpful for me.

  • Valuable info. Lucky me I found your site by accident, I bookmarked it.

  • Really nice post,thank you, best website ever

  • Pingback: How To Setup jQuery in 3 Easy Steps | jQuery4u()

  • Great blog!!! A++++

  • Pingback: to disable hotlinking | jQuery4u()

  • Thanks for taking the time to post for people like me, who are just getting into it. This is the first site that i’ve found that shows you step by step how and where to input the codes. Have you got anymore that could help a newbie, as i would like to update my jQuery.

  • Yogesh

    very much important info. nice .

Get the latest in JavaScript, once a week, for free.