Created
March 29, 2014 18:17
-
-
Save max-mapper/9859401 to your computer and use it in GitHub Desktop.
load a <script> tag from a gist raw url
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
<!doctype html> | |
<html> | |
<head> | |
<style type="text/css"> | |
html, body { margin: 0; padding: 0; } | |
</style> | |
</head> | |
<body> | |
<script type='text/javascript'> | |
function loadRaw(gistID) { | |
var bundleURL = "https://gist.githubusercontent.com/" + gistID + "/raw/minified.js" | |
var script = document.createElement('script') | |
script.setAttribute('src', bundleURL) | |
document.head.appendChild(script) | |
} | |
loadRaw('maxogden/9576573') | |
</script> | |
</body> | |
</html> |
This might not work now. As a work around, you could use a free service in lieu of a CDN -> rawgithack
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have tried use your codes, but console said
efused to load the script '*https://gist.****' because it violates the following Content Security Policy directive: "script-src c.s-microsoft.com/mscc/ assets.msn.com assets.msn.cn 'self' www.bing.com/as/ www.bing.com/s/as/ platform.bing.com/geo/AutoSuggest/v1 'nonce-Y2J2NlGO+d0dW6ej5F4E8vgQz41jscUMjUWueD0zn78='". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.