Posted By

Deej on 10/29/10


Tagged

html google jquery


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

maltem
mikael12


Conditionally Loading jQuery


 / Published in: HTML
 

URL: http://net.tutsplus.com/tutorials/javascript-ajax/14-helpful-jquery-tricks-notes-and-best-practices/

if window.jQuery is undefined, there must have been a problem downloading the script from the CDN. In that case, proceed to the right side of the && operator, and insert a script linking to a local version of jQuery.

  1. <!-- Grab Google CDN jQuery. fall back to local if necessary -->
  2. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  3. <script>!window.jQuery && document.write('<script src="js/jquery-1.4.2.min.js"><\/script>')</script>

Report this snippet  

You need to login to post a comment.