Created
June 5, 2018 23:23
-
-
Save guiassemany/44dbe991e7bf38563d84d20470137294 to your computer and use it in GitHub Desktop.
CDN Fallback
This file contains hidden or 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> | |
<head> | |
<!-- Bootstrap CSS CDN --> | |
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css"> | |
</head> | |
<body> | |
<!-- APP CONTENT --> | |
<!-- jQuery CDN --> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/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.0.3/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 --> | |
<div id="bootstrapCssTest" class="hidden"></div> | |
<script> | |
$(function() { | |
if ($('#bootstrapCssTest').is(':visible')) { | |
$("head").prepend('<link rel="stylesheet" href="/local/bootstrap.min.css">'); | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment