Forked from benjamincharity/Local Fallback for jQuery and Modernizr
Created
October 16, 2015 09:08
-
-
Save rowild/b3d94cbdc7235e8b982b to your computer and use it in GitHub Desktop.
Include jQuery and Modernizr from a CDN and add local fallbacks in case the CDN fails. Versions written in HTML and HAML.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTML | |
===== | |
<script type='text/javascript'> | |
window.jQuery || document.write('<script src="js/jquery-1.7.1.js">\x3C/script>') | |
</script> | |
<script src='http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.0.6/modernizr.min.js' type='text/javascript'></script> | |
<script type='text/javascript'> | |
window.Modernizr || document.write('<script src="js/modernizr-2.0.6.js">\x3C/script>') | |
</script> | |
HAML | |
===== | |
%script(type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js") | |
:javascript | |
window.jQuery || document.write('<script src="js/jquery-1.7.1.js">\x3C/script>') | |
%script(type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.0.6/modernizr.min.js") | |
:javascript | |
window.Modernizr || document.write('<script src="js/modernizr-2.0.6.js">\x3C/script>') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment