Skip to content

Instantly share code, notes, and snippets.

@oquirozm
Last active January 16, 2016 02:05
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 oquirozm/f08693c7d308c9f20b18 to your computer and use it in GitHub Desktop.
Save oquirozm/f08693c7d308c9f20b18 to your computer and use it in GitHub Desktop.
Bootstrap + jQuery CDN-Local Fallback
<head>
<!-- Bootstrap CSS CDN -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
</head>
<body>
<!-- APP CONTENT -->
<!-- jQuery CDN -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<!-- jQuery local fallback -->
<script>window.jQuery || document.write('<script src="/local/jquery.min.js"><\/script>')</script>
<!-- Bootstrap JS CDN -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<!-- Bootstrap JS local fallback -->
<script>if(typeof($.fn.modal) === 'undefined') {document.write('<script src="/local/bootstrap.min.js"><\/script>')}</script>
<!-- Bootstrap CSS local fallback -->
<script>
$(document).ready(function() {
var bodyColor = $('body').css('color');
if(bodyColor != 'rgb(51, 51, 51)') {
$("head").prepend('<link rel="stylesheet" href="/local/bootstrap.min.css">');}});
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment