Skip to content

Instantly share code, notes, and snippets.

@jpdevries
Created March 16, 2015 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpdevries/7ececfe8b1973a4d39ae to your computer and use it in GitHub Desktop.
Save jpdevries/7ececfe8b1973a4d39ae to your computer and use it in GitHub Desktop.
Load modernizr.js from CDN with local fallback
<!-- try to load modernizr from a CDN, use h5bp-ish style fallback to load locally if needed -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>
<script>try{Modernizr} catch(e) {document.write('<script src="./assets/js/vendor/modernizr-2.8.3.min.js"><\/script>')}</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment