Check for jQuery CDN, fallback to local version

/ Published in: JavaScript
Save to your folder(s)

Use CDN if online. Fallback to local version if offline.

Copy this code and paste it in your HTML
  1. <!-- Google AJAX Libraries - jQuery 1.7.1 at 2011-12 -->
  2. <script src=""></script>
  3. <script type="text/javascript">
  4. google.load("jquery", "1.7.1");
  5. </script>
  7. <!-- Let's check if we are on or off line -->
  8. <script type="text/javascript">!window.jQuery && document.write(unescape('%3Cscript type="text/javascript" src="js/jquery-1.7.1.min.js"%3E%3C/script%3E'))</script>

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.