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

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

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