显然,在我使用该技术后,似乎我的网站其他脚本没有加载,因为它比外部脚本提取慢。具体做法是:
脚本:
function downloadJSAtOnload() {
var jq = document.createElement("script");
jq.src = "path/to/jquery.min.js";
document.body.appendChild(jq);
var bs = document.createElement("script");
bs.src = "path/to/bootstrap.min.js";
document.body.appendChild(bs);
}
// Check for browser support of event handling capability
if (window.addEventListener)
window.addEventListener("load", downloadJSAtOnload, false);
else if (window.attachEvent)
window.attachEvent("onload", downloadJSAtOnload);
else window.onload = downloadJSAtOnload;
//Scripts here aren't able to load even though jquery is called above
$('.tips').tooltip();
$(document).ready(function() {/**something here**/
});
<小时/> 我该如何解决这个问题?