Home » jQuery » Host jQuery at Google (with Intellisense support)

Host jQuery at Google (with Intellisense support)

tp_vol3_007 While reviewing my RSS feed this morning, I found this article:

3 reasons why you should let Google host jQuery for you | Encosia

I had no idea!

The three reasons are:

  1. Decreased Latency
    Google will serve the data from the closest server
  2. Increased Parallelism
    More threads are available to download content specific to your application instead of downloading this common library.
  3. Better caching
    They may already have the library on their computer.

Here is the code you should be using to include jQuery in your application to use the Content Delivery Network at Google:

    <script type="text/javascript"

The one issue you may have to deal with is that if you are using the intellisense files for Visual Studio, you will need to find some alternate method.  Here’s one:

First, place the reference to your local jquery files like we’ve been doing:

<script src="js/jquery-1.2.6.min.js"

But then in the onload event, put in code to replace the src attribute so that it will get the js file from google:

protected void Page_Load(object sender, EventArgs e)
 foreach (Control c in Page.Header.Controls)
  if (c.GetType() == typeof(LiteralControl))
   ((LiteralControl)c).Text =


This code might be optimized a bit better.  For example, by making sure the js reference is the first element in your header, you could skip the foreach loop and just grab the first element out of the controls collection.


Other post in jQuery

Related Post

  • jQuery, JSON, and ASP.NETjQuery, JSON, and ASP.NET A few months ago, I demonstrated how to use ASP.NET's JSON capabilities.  Lately, I've been demonstrating how to use jQuery.  Both use a considerable amount of JavaScript so if there is […]
  • jQuery – Retrieving HTML FragmentsjQuery – Retrieving HTML Fragments A couple of weeks ago I mentioned that I had built a tooltip using jQuery.  We focused mostly on the positioning of the tooltip at the time because, historically, that's where most of the […]
  • jQuery SplitterjQuery Splitter Hey!  This is pretty cool. I was just mentioning at the last jQuery presentation I did that there were some controls that were definitely missing from the jQuery UI suite of […]
  • Overriding Events in VB.NETOverriding Events in VB.NET Back in the day, you use to be able to override an event in VB by using the drop down list in the code window.  Today, I had a friend who is moving from Visual Studio 2003 to Visual Studio […]
  • jQuery – Auto Scrolling the SliderjQuery – Auto Scrolling the Slider Question from Yuhsin: I would like to make the jquery steps slider to do auto-increment when the window loads. Is there an easy way to trigger the slide to move by itself ? I'm assuming […]

About Dave Bush

Dave Bush is a Full Stack ASP.NET developer focusing on ASP.NET, C#, Node.js, JavaScript, HTML, CSS, BootStrap, and Angular.JS.Does your team need additional help in any of the above? Contact Dave today.

One Pingback/Trackback