Hi everyone,
The more i use JavaScript the more i try to come up with efficient ways of loading and executing my scripts. One method i have found to be really useful is loading javascript without blocking.
function include_js(url) {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = url;
document.getElementsByTagName("head")[0].appendChild(script);
}
include_js('script.js');
JavaScript also has a window method that executes when the page has loaded.
window.onload = function() {
alert('Script executed onload');
};
What i want to know is, how does the browser treat script executed by the window.onload method, is it blocking or non-blocking script?