On Jun 24, 7:56 pm, Khai <[email protected]> wrote:

> I have an opensocial application which previously work on igoogle, but
> now it does not work anymore.  This application use
> gadgets.util.registerOnLoadHandler(callback).

The behavior of the onload handler has changed recently; it used to be
called from the actual window.load event of the iframe, and now it's
called at the end of the body like this:
<script>gadgets.util.runOnLoadHandlers();</script>

I've had this change break some gadgets where my load handlers are in
dynamically-generated script tags; they haven't been included yet when
the above gets run, whereas they are by the time the window.onload
handler fires.

> How can I work around this problem?  Why do we need to use
> registerOnLoadHandler() instead of simply register an onload handler
> on the iframe using our favorite js library (jQuery, YUI, etc..)?

Depends on how risk-averse you are. :^) I've used that workaround
myself, and it seems to work, but YMMV. The registerOnLoadHandler
method is the officially documented technique, and if you don't use it
there's probably a greater risk that your gadget won't work on some
container, now or in the future.

Of course, your and my gadgets broke BECAUSE we used the officially
documented technique, which Google then moved out from under us - so
take the above warning with a pound of salt.

String
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Gadgets-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to