What order is JavaScript executed in a browser?

Associate
Joined
24 Jun 2006
Posts
1,462
I'm trying to optimise my pages as much as possible which means trying to move the JS includes to the bottom of the page.

There are one or two pages on the site that require inline JavaScript.

Does anyone know if a browser will try and execute this before the includes have loaded?

I'm using jQuery so most stuff is already wrapped in:

Code:
jQuery(document).ready(function() {
});

Cheers!
Paul.
 
Anyway, back OT. The order JS is executed is dependent on the page, and the events the code is attached to.

The easiest way to test is to put an alert into each function and note down the order in which they appear.

Cheers! Well every little helps on a large site and depends whether or not the JS is set to cache or not.

Also noticed http://www.smu****.com/ysmush.it/ which knocked the page weight down a fair bit.
 
Back
Top Bottom