📅  最后修改于: 2022-03-11 15:02:14.752000             🧑  作者: Mango
function injectScript(src,callback){
var script = document.createElement('script');
script.src = src;
script.onload=function(){
callback();
}
document.head.appendChild(script);
}
injectScript('https://www.mysite.com/somescript.js', function(){
//the script is now all loaded
});