[whatwg] <link> onLoad event

Ian Hickson ian at hixie.ch
Thu Jan 6 13:46:51 PST 2011

On Wed, 27 Oct 2010, Diogo Resende wrote:
> Is there a way to know that a <link> has been loaded (and processed)? 
> I'm more interested in CSS links than others but the process should be 
> the same. In my opinion it's a better way of loading stylesheets than 
> downloading using XmlHttpRequest and then creating the <style> with all 
> that inside (seems <style> does not support onLoad either..).
> This is important for developers to create elements knowing they will 
> have the correct styling immediately and not some moments after.

For <link> elements for external resources like style sheets, you can 
check to see when the 'load' event fires (e.g. using onload).

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list