Benefits vs. Pitfalls of hosting jQuery locally [closed]

I always use the CDN (Content Delivery Network) from Google. But just in case it’s offline:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>!window.jQuery && document.write('<script src="jquery-1.4.2.min.js"><\/script>')</script>

Grab Google CDN’s jQuery and fallback to local if necessary

Edit:
If you don’t need to support IE6 and your site has partial https usage you can remove the http as well:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

Leave a Comment