I know when browser loads javascript files or inline javascript it will block,and the order is the same as they appear in page.I want to know when browser loads other sources if there is any preload?
Asked
Active
Viewed 50 times
0
-
Yes, it loads in order. If you want to make sure something is loaded, you can do your code after everything is loaded. The body element has a event call `onload`. When this event is called, the javascript (all of them) has already being parsed. I dont know what really is your question but I hope this answer something. – wendelbsilva Sep 24 '13 at 04:35
-
In addition, if by other resources you mean images, css, etc. For html, javascript and css it loads in the same "loader". Although, other resources will be loaded on demand. Of course, you can 'hack' and make your code load a javascript only when you want it.. but its a hack. – wendelbsilva Sep 24 '13 at 04:38
-
1[This is the answer.](http://stackoverflow.com/questions/1795438/load-and-execution-sequence-of-a-web-page). – The Alpha Sep 24 '13 at 04:39
-
Also, `JavaScripts` could be loaded asynchronously, without blocking the page load. – The Alpha Sep 24 '13 at 04:41
-
[Load Non-blocking JavaScript with HTML5 Async and Defer.](http://www.sitepoint.com/non-blocking-async-defer/) – The Alpha Sep 24 '13 at 04:43
-
Thanks all of you,I have a better know about it now. – Joyce Lee Sep 24 '13 at 06:56