Created
June 3, 2020 06:49
-
-
Save tianyk/9a3be3a84d13514423dae101a0c33574 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
var importScript = (function (oBody) { | |
return function (sSrc, fOnload) { | |
var oScript = document.createElement('script'); | |
oScript.type = 'text\/javascript'; | |
if (typeof fOnload === 'function') { | |
oScript.onerror = function (evt) { | |
fOnload(new URIError('The script ' + evt.target.src + ' is not accessible.')); | |
}; | |
oScript.onload = function () { | |
fOnload(); | |
}; | |
} | |
oBody.appendChild(oScript); | |
oScript.src = sSrc; | |
} | |
})(document.body || document.getElementsByTagName('body')[0]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment