Use Google to host jQuery for you

One of the things I’m always doing for any project that uses jQuery is searching Google for the URL of the latest version of jQuery hosted on Google’s CDN. To make this easier for myself and to give anyone else who may find it useful I thought I’d post it here for reference. No messing, here is the code to use if you want Google to host jQuery for you:

1
2
3
4
5
6
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
   //your jQuery code goes here!
});
</script>

As you can probably see from viewing the source of this page, I am using this very code to load jQuery. There are many benefits to using Google’s CDN to host jQuery for you, one of them is it will save you bandwidth over time. The file size of jQuery 1.3.2 is 182kb, which over time will add up.

If you want to to always have the very latest version of jQuery loaded (not recommended) then you can use the following URL:

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

If you require any assistance please use the comments below to get in contact and someone will be able to assist.

  • testtest
    testtest
blog comments powered by Disqus

Enter your email address: