It’s a very basic question – are scripts and images loaded synchronously or ansynchronously in webpages (such as what happens in ajax requests) ? I’m talking about including of images and scripts the regular html way –
and
I was just wondering how browsers react to including relatively large files such as jQuery(which is about 2mb last I checked) or other big libraries or big images , should I worry that this will get my users stuck for several seconds upon connecting to my website ? I specifically want to know about the jQuery overhead since I’m considering using it for a small project…
Images are loaded asynchronously and possibly concurrently. Don’t bother about them, just make them as small as possible and use CSS sprites.
Scripts are blocking, i.e. you cannot load next script before you finished downloading the previous one. This is understandable since there might be some inter-script dependencies.
What you typically do is compressing and minifying all JavaScript resources into one file which you include at the bottom of your page. This way the page is nicely rendered giving good user experience and the scripts loads at the end. After all, you typically run scripts not earlier then on DOM ready event.
And BTW jQuery minified is only around 93K. And if you use the link above, it will most likely be cached in the browser once and for all.