Jaap Vossers' SharePoint Blog

Just another WordPress.com site

Archive for June 2009

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