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

[whatwg] should we add beforeload/afterload events to the web platform?

From: Tantek Çelik <tantek@cs.stanford.edu>
Date: Mon, 9 Jan 2012 21:48:03 -0800
Message-ID: <CAOACb=L3hULyrahBLY7tGMoysPazeqONHO1oGJHnbW8ad7P4KQ@mail.gmail.com>
WebKit supports a 'beforeload' event [1] which is supported in
shipping Safari and Chrome[2]
and apparently has (enabled) the real-world use-cases of:

1. Performance. Reducing bandwidth use / HTTP requests, e.g. AdBlock
2. Clientside transformations, e.g. Mobify[3]

As might be expected, there is at least one use-case for a
complementary 'afterload' event:

1. Downloadable fonts - people who want to use custom fonts for
drawing in the canvas element need to know when a font has loaded.
'afterload' seems like a good way to know that, since it happens as a
side effect of actually using it and fonts don't have an explicit load
API like images do.[4]

Safari and Chrome have already shipped 'beforeload', and Mozilla is
strongly considering implementing 'beforeload' and 'afterload'.[4]

Should 'beforeload'/'afterload' be explicitly specified and added to
the web platform?

Rather than attempt to provide a specific detailed design at this
point, I'd prefer to ask for the list's consideration/discussion, and
leave detailed specification of the two events to the editor.



[1] http://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/MessagesandProxies/MessagesandProxies.html
[2] http://google-chrome-browser.com/tags/beforeload
[3] http://mobify.com/static/talks/client-side-transformations.html#27
[4] https://bugzilla.mozilla.org/show_bug.cgi?id=715695#c9

http://tantek.com/ - I made an HTML5 tutorial! http://tantek.com/html5
Received on Monday, 9 January 2012 21:48:03 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:10 UTC