Context: We've faced an insane page load time (70s+) due to external analytics script being slow to load (yeah, we should have been loading the app on DOMContentLoaded instead of onload).
Since `load` waits for all iframes and images, you typically don't want JS initialization to be dependent on it.
For non-critical third-party scripts, you might actually want to do something like doc.on('DOMContentLoaded', e => setTimeout(requestIdleCallback(init3rdparties), 2000));
Hi Paul, thanks for sharing the `requestIdleCallback`, I didn't know it, pretty interesting! Though since it's only in Chrome 47+, it will take a while for it to gain market adoption.
It means that if you have listeners to `load` event that are doing stuff, you may want to have the `load` event as fast as possible.
Also, until the load event is raised, browsers display a spinner instead of page's favicon.
Hence for non-critical third-party scripts, you may prefer to actually inject them in JS in onload handler instead of putting them directly in HTML.
A semi-related issue is handling failures of external non-critical scripts (analytics blocked by adblock etc)
I wrote a draft of a blog article on the topic last week:
https://gist.github.com/jakub-g/5286483ff5f29e8fdd9f
Context: We've faced an insane page load time (70s+) due to external analytics script being slow to load (yeah, we should have been loading the app on DOMContentLoaded instead of onload).