W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2011

[whatwg] <link> onLoad event

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 6 Jan 2011 21:46:51 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1101062142130.29066@ps20323.dreamhostps.com>
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).

HTH,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 6 January 2011 13:46:51 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:29 UTC