[whatwg] Link.onload

Greg Houston gregory.houston at gmail.com
Sat Mar 14 13:48:07 PDT 2009

This is a request for the link element to be given an onload attribute.

Often when lazy loading a plugin into an web app it is necessary for
the plugin's stylesheets to be applied before the plugin's JavaScript
is downloaded. Without the link element having an onload event there
is not really a straightforward way of doing this.

Currently I am using XMLHttpRequests to grab the stylesheets first
since XHR has a success callback, and then appending the stylesheets
to the document.head relying on the browser using the cached
stylesheet. This seems to work for the most part, but really there are
no guarantees.

There are other odd workarounds but none of them as straightforward,
elegant, and easy to use as the link elements simply having an onload

Thank you for your consideration.

Greg Houston

More information about the whatwg mailing list