Skip to content

Instantly share code, notes, and snippets.

@apphp-snippets
Created August 12, 2013 08:33
Show Gist options
  • Save apphp-snippets/6209104 to your computer and use it in GitHub Desktop.
Save apphp-snippets/6209104 to your computer and use it in GitHub Desktop.
Nowadays majority of sites uses the jQuery JavaScript library. A lot of them also make use of Google's hosted version of the library from some reasons: faster loading, better cross site caching etc. However, what if there is ever a problem and jQuery is not loaded from Google? For example when you work on localhost and there is no Internet conne…
<!-- http://www.apphp.com/index.php?page=html_snippets -->
<!-- Grab Google CDN's jQuery and load local version if necessary -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">!window.jQuery && document.write('<script src="js/jquery-1.4.2.min.js"><\/script>')</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment