Does jQuery ship with SharePoint 2010? (and why you should be using an Ajax CDN)

jQuery is one of the most popular javascript libraries used by ASP.NET developers.  In fact, jQuery ships with Visual Studio 2010.  It is in the “Scripts” folder of a new “ASP.NET Web Application” or “ASP.NET MVC 2 Web Application” project template.

Does jQuery ship with SharePoint 2010?  Short answer: No.  I see this asked (publicly and internally) a few times a month.  Long answer: You don’t need it to.  Just use it from the Microsoft Ajax CDN

Assuming you don’t have to build a solution on a closed network with no internet access, then one of the first things you should consider is to replace all the references in your code to local javascript files to CDN references.  By doing so you get the general benefit that all CDNs offer (not just Ajax CDNs) which is that you get directed to a server the is closer to you.  Also, since browsers cache files based on URL, referencing the CDN from all your code means that different web apps use the same version of the javascript file cached in the browser.  Last, but not least, it means less files you have to maintain on your own servers.

Here’s what a script reference to jQuery 1.4.2 looks like when it is local:

<script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

Here’s what it looks like when referencing the CDN:

<script src="" type="text/javascript"></script>

So that’s how easy it is to reference jQuery from your SharePoint code.  However, as you can see, this applies way beyond just SharePoint programming.

Comments (7)

  1. Bil Simser says:

    I agree that using jQuery from a CDN is useful but I don't agree it should be done on a corporate intranet. Even if you have internet access, you really don't want to be fetching stuff from outside the firewall. There's no value in an intranet to use a CDN. On a public internet site, sure.

  2. keydet says:


    Care to elaborate on why "you really don't want to be fetching stuff from outside the firewall.  There's no value in an intranet to use a CDN."?  Maybe I am missing something here, but you still get the benefit of the browser caching the file once and not needing to maintain the files on your own servers.

  3. Jody says:

    My problem is that if you're running an https environment pointing to CDN makes your browser throw the prompt "do you want to show unsecured content?"

  4. keydet says:

    I believe all the populare Ajax CDNs support https.


  5. pumm3l says:

    What happens if Microsoft decides to kill CDN in the future? All your script references will no longer work.  Unlikely any time soon but who's to say? Having a local reference means you don't have to worry about relying on a 3rd party for your site to work properly.

  6. devkeydet says:

    Sure.  Everything has its pros/cons.  There is no perfect answer:).  Its up to the individual/team to weigh them and decide based on requirements/needs.  If those risks are enough to cause you to not use a CDN, then there's your answer.  If the benefits outweigh the risks to you, then great.

  7. Steve says:

    How can it posibly be good practise to allow a library to be loaded from an untrustable 3rd party CDN as part of an internal (ie non internet-facing) service.

Skip to main content