Best Practice on Referencing jQuery

I picked this tip up whilst doing a course on jQuery for Web designers by Joe Chellman.

I always knew that accessing your jQuery library from a CDN (content delivery network) that you will be able to serve your user users faster than downloading it from your own server. Google’s CDN is even better since it has data centres all around the world and therefor serves the most relevant content to the user based on their current location.

Although Google will always have a fallback option incase one server is down, its nice to add your very own fall back option by adding a Boolean Or statement to your html.

jquery reference snippet

<script src=””></script>

<script>window.jQuery || document.write(‘<script src=”../../jquery/jquery.min.js”><\/script>’);</script>


Leave a Reply

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