Skip to content

Instantly share code, notes, and snippets.

@wtw24
Created August 20, 2018 13:22
Show Gist options
  • Save wtw24/9fd93b2e9d2c379f370824f8ec14a9b4 to your computer and use it in GitHub Desktop.
Save wtw24/9fd93b2e9d2c379f370824f8ec14a9b4 to your computer and use it in GitHub Desktop.
isCDN?
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script>
var cssHref = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css";
var needLocalCss = true;
for (var i = 0; i < document.styleSheets.length; i++) {
if (document.styleSheets[i].href === cssHref && document.styleSheets[i].cssRules.length > 0) {
needLocalCss = false;
}
}
if (needLocalCss === true) {
var cssLinkNode = document.createElement("link");
cssLinkNode.href = "/lib/bootstrap-3.3.7.min.css";
cssLinkNode.rel = "stylesheet";
document.head.insertBefore(cssLinkNode, document.head.firstChild);
}
if (typeof(jQuery) === "undefined") {
document.write("<script src='/lib/jquery-3.1.1.min.js'><\/script>");
}
if (typeof($.fn.modal) === "undefined") {
document.write("<script src='/lib/bootstrap-3.3.7.min.js'><\/script>");
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment