Check if asynchronous javascript file is loaded

I would like to “load” my page only after all asynchronous files have been loaded. Is there a way I can be notified when an asynchronous file is uploaded?

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> 
+1
source share
1 answer

Providing one of your scripts with an identifier ...

 <script src='fileone.js' type='text/javascript' async id='script_1'></script> <script> document.getElementById("script1").onload = script.onreadystatechange = function(){ alert("Script loaded!"); } </script> 
+2
source

Source: https://habr.com/ru/post/1239712/


All Articles