Last active
May 8, 2019 16:03
-
-
Save skywind3000/ef6ade267de146ccbbaaed292fc2c69c to your computer and use it in GitHub Desktop.
[javascript] async load script #js #async
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() { | |
var hm = document.createElement("script"); | |
hm.src = "https://hm.baidu.com/hm.js?430525c455fa119f047f66ba9aa5e3b1"; | |
var s = document.getElementsByTagName("script")[0]; | |
s.parentNode.insertBefore(hm, s); | |
})(); |
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 script = document.createElement('script'); | |
script.src = 'xxxxxxxxxxxxxxxx.viz.js'; // 加载脚本路径 | |
script.onload = function(){ | |
// 代码。。。。 | |
}; | |
// 在头部插入 script | |
var head = document.getElementsByTagName('head')[0]; | |
head.appendChild(script); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment