As someone else mentioned, a local fallback is always a good idea, but you should also set the IE vs non-IE versions appropriately. Something simple like this should do the trick:
<!--[if lt IE 9]>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js""></script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<!--<![endif]-->
<script>
if (!window.jQuery) {
document.write('<script src="/path/to/your/jquery"><\/script>');
}
</script>
The first part is the conditional if for jQuery built with workarounds for older IE vs the faster, more efficient jQuery 2.0 version. This uses the Google CDN since that has both http
and https
versions, whereas code.jquery.com
only has http
. If https
is not a concern, though, the code.jquery.com
CDN is usually faster.
The second piece is checking if window.jQuery
was created, and if not, use the local version.
The benefit to using a CDN version vs local version is just speed. Not only is their server bandwidth likely much (MUCH) larger than yours, most browsers have accessed that version before and have it stored in cache so the browser doesn't need to redownload it.