javascript - How does the browser know if a script is finished loading? -


how web browser know if script inside <script> tag has finished loading?

the onload event fires when resource (such script, or stylesheet) loaded:

var oscript = document.createelement("script"); oscript.type = "text\/javascript"; oscript.onload = function () {   // when script loaded } document.getelementsbytagname("head")[0].appendchild(oscript); oscript.src = "path/to/script"; 

the onload event not work on inline scripts.


Comments

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -