Jaap Vossers' SharePoint Blog

Just another WordPress.com site

Using Google Ajax Libraries API to load jQuery

with one comment

Google provides a client side API (Google AJAX Libraries API) for developers to load the jQuery library on their web pages without the need to host the jQuery library on your own site. This is particularly interesting for jQuery based scripts that can be hosted in a Content Editor Web Part in SharePoint, since you can more or less “embed” the jQuery library in your script, thereby simplifying its distribution and installation processes. The CEWP version of SharePoint InstantListFilter implements this concept.

There are several other reasons why it may be a good idea to use Google’s API to load jQuery. Have a look at 3 reasons why you should let Google host jQuery for you.

Now, one thing you need to be aware of, is that your browser may start bugging you with warnings if your site runs on https. This is because it does not like having both secure (https) and non-secure (http) items on a single page.

mixedcontent

In that case, all you need to do is to load Google’s API over https as well, which should remove the non-secure item from the page.

So in your script replace this:

<script src=”http://www.google.com/jsapi”></script&gt;

With this:

<script src=”https://www.google.com/jsapi”></script&gt;

Written by jvossers

June 6, 2009 at 7:16 pm

Posted in jQuery

One Response

Subscribe to comments with RSS.

  1. Hi Jaap,
    Great article. Do you know how this plays with Visual Studio 2008’s Rich Intellisense for JQuery? I haven’t tried it yet, but there example is source the .js locally.
    Tom
    http://blogs.msdn.com/webdevtools/archive/2008/10/28/rich-intellisense-for-jquery.aspx

    Tom Resing

    September 19, 2009 at 3:30 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: