我只想在加载所有异步文件后“引导”我的页面。有没有办法在加载异步文件时收到通知?
的index.html
<script src="fileone.js" type="text/javascript" async></script>
<script src="filetwo.js" type="text/javascript" async></script>
<script src="bootstrap.js" type="text/javascript" async></script>
答案 0 :(得分:5)
为您的一个脚本提供ID ...
<script src='fileone.js' type='text/javascript' async id='script_1'></script>
<script>
document.getElementById("script1").onload = script.onreadystatechange = function(){ alert("Script loaded!"); }
</script>