On Jun 24, 12:10 am, skeeJay <[email protected]> wrote:

> The problem is that when the gadget uses the new embedding method, it
> breaks _IG_AdjustIFrameHeight.  Consistently, every single time, the
> gadget is incapable of resizing itself.

You're absolutely right. _IG_AdjustIFrameHeight is well and truly
broken in syndication. I've been able to reproduce this for my own
gadgets, and I'm posting my findings here in the hope of convincing
Google that we aren't all just imagining this.

First, here are my URLs.
The gadget I'm testing with: http://gad.getpla.net/feed/reader.xml
A syndicated page where you can find it: http://gad.getpla.net/feed/
Just to be clear, the issue is that its iframe should adjust in size
to nicely fit the retrieved feed content, and half the time it
doesn't. Refresh the page a few times if you need to, until the feed
content in the gadget is cut off.

As skeeJay said, it's definitely linked to the domain from which the
gadget iframe is served. Digging into the API's JS code, I find that
the new (broken) domain is actually defining  _IG_AdjustIFrameHeight
TWICE. First is this:

var _IG_AdjustIFrameHeight = gadgets.window.adjustHeight;

Looks fine, it's just being set up as an alias for the gadgets.*
equivalent. But then later in the iframe source is another definition,
which looks like this (de-obfuscated for clarity):

_IG_AdjustIFrameHeight = function(opt_height) {
  if(typeof opt_height != "undefined") {
    gadgets.window.adjustHeight(opt_height);
  }
};

Notice anything funny there? In the second definition (which replaces
the first), _IG_AdjustIFrameHeight expects to be passed the target
height - and if it's not, the underlying gadgets.window.adjustHeight
never gets called. Is it any surprise that our (parameter-less) calls
to _IG_AdjustIFrameHeight aren't working? What was Google thinking,
releasing code like this into production?

Fortunately, there is an easy workaround: simply redo the alias
yourself. Insert this code before your first call to
_IG_AdjustIFrameHeight:

if (!!gadgets && !!gadgets.window && !!gadgets.window.adjustHeight)
  window._IG_AdjustIFrameHeight = gadgets.window.adjustHeight;

This seems to work on both the old and new domains. I suggest adding
this to any dynamic-height gadgets in syndication until Google either
fixes the gadgets.* platform or rolls us back to Legacy.

FWIW, I'm not seeing this erroneous second definition on iGoogle,
either in the sandbox or the live page. IOW, this isn't the same
problem that's plaguing _IG_AdjustIFrameHeight on iGoogle. Maybe I'll
dig into that one next. :^)

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