0

Load JQuery scripts from a CDN with local fallback

Page ContentHow many unique visitors you`ve got last month? I bet the number is still under 1 billion, right?
So you’d better use Google’s copy of jQuery instead of yours. If your user still has the cached file of Google’s website (or from many other sites that uses its CDN*) his browser will just get the cached version, improving a lot your website’s performance. You can use it by copying & pasting this HTML:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.2.min.js"><\/script>')</script>

In SharePoint scenarios this is very useful in Internet Websites and in Intranet sites where you now the local network has internet access.

* CDN = Content Delivery Network

Find more JQuery tips on http://webdesignledger.com/tips/9-jquery-mistakes-you-shouldnt-commit

Leave a Reply

Your email address will not be published. Required fields are marked *