Created
August 14, 2015 15:48
-
-
Save davydog187/13dea7ef484491ff45d6 to your computer and use it in GitHub Desktop.
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
function makeBootstrappingLoader(scriptBody, clientAppUrl, isAsync) { | |
var loadAsync = isAsync ? "s.async = true;\n" : ""; | |
return "<script type=\"text/javascript\">\n" + | |
"var s = document.createElement(\"script\");\n" + | |
"s.setAttribute(\"src\", \"" + clientAppUrl + "\");\n" + | |
"document.body.insertBefore(s, null)\n"+ | |
loadAsync + | |
"function loaded(e) {\n" + | |
scriptBody + "\n" + | |
"s.removeEventListener(\"load\", loaded, false);\n" + | |
"}\n" + | |
"s.addEventListener(\"load\", loaded);\n" + | |
"</script>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change line 6 from body to head