Created
April 24, 2020 10:31
-
-
Save ilikerobots/6e41bb859e54989bf9bad970b7f41229 to your computer and use it in GitHub Desktop.
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
function load_bundle_file(url, filetype) { | |
let fileref; | |
if (filetype === "js") { // build js script tag | |
fileref = document.createElement('script'); | |
fileref.setAttribute("type", "text/javascript"); | |
fileref.setAttribute("src", url); | |
} else if (filetype === "css") { // build css link tag | |
fileref = document.createElement("link"); | |
fileref.setAttribute("rel", "stylesheet"); | |
fileref.setAttribute("type", "text/css"); | |
fileref.setAttribute("href", url); | |
} | |
if (typeof fileref != "undefined") | |
document.getElementsByTagName("head")[0].appendChild(fileref); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment