[Vanila JS] 동적으로 javascript 를 javascript 로 읽어들이기: load script inside script
By 양파개발자 SW의 블로그입니다^^ | 2019년 8월 27일 |
(function(document, tag) { var scriptTag = document.createElement(tag), // create a script tag firstScriptTag = document.getElementsByTagName(tag)[0]; // find the first script tag in the document // set the source of the script to your script scriptTag.src = "MY_SCRIPT_FILE_OR_URL"; firstScriptTag.parentNode.insertBefore(scriptTag, firstScriptTag); // append the script to