You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Martin Webb <ma...@gmail.com> on 2008/03/22 12:17:15 UTC

Setting the gadgets height once loaded from the container

Is this possible?  Can I get the gadgets actual height rather than the
iframe height, and then set the iframe height to show the gadget in full?

Several gadgets don't require the dynamic height feature, so the gadget
server doesn't inject the dynamicHeight.js - and the container just shows
the gadget using a default iframe height - is this the correct behaviour,
shouldn't dynamicHeight.js always be injected into the gadget?  How is the
container supposed to show the gadget in full?

Regards
Martin
-- 
Internet Related Technologies - http://www.irt.org

Re: Setting the gadgets height once loaded from the container

Posted by Kevin Brown <et...@google.com>.
On Tue, Mar 25, 2008 at 2:40 AM, Martin Webb <ma...@gmail.com>
wrote:

> Kevin,
>
> I'm running a gadget container on a different domain/port than the gadget
> server - and thus cannot directly call the metadata servlet fromt he
> browser
> using JSON with POST.  I'd rather not clone the servlet code and copy into
> my gadget container...  Which is why I asked (in another thread) if it
> could
> be possible to package the servlets up into a JAR (possibly with as many
> as
> a the core classes as needed).


The metadata APIs are actually designed under the assumption that they'll be
called from your server side code that generates your parent page. On a
production site, this is critical for scalability and end user latency, and
it's the only way you'd be able to generate security tokens (essential for
supporting "real" opensocial deployments). Calling them from javascript is
useful for illustrative purposes, but it's definitely *not* the intended
production deployment situation.

A typical gadget-containing parent page should have a flow something like
this:

- Fetch user data from back end
- Determine which gadgets to render for the user
- Fetch gadget metadata from metadata service (optionally caching responses
if appropriate)
- Append security tokens or other request-specific details to the response
data
- Generate output html, including iframe code.

If your production site is already using Java, you could always just use the
core code directly in your front end as well (no need to "clone" anything).
This limits scaling opportunities, but it should be fine for small to medium
sites.

-- 
~Kevin

Re: Setting the gadgets height once loaded from the container

Posted by Martin Webb <ma...@gmail.com>.
On Sun, Mar 23, 2008 at 2:08 AM, Kevin Brown <et...@google.com> wrote:

> On Sat, Mar 22, 2008 at 4:17 AM, Martin Webb <ma...@gmail.com>
> wrote:
>
> > Is this possible?  Can I get the gadgets actual height rather than the
> > iframe height, and then set the iframe height to show the gadget in
> full?
>
> or
>
> Use the metadata APIs (/gadgets/metadata) to get the height specified in
> the
> gadget.
>

Kevin,

I'm running a gadget container on a different domain/port than the gadget
server - and thus cannot directly call the metadata servlet fromt he browser
using JSON with POST.  I'd rather not clone the servlet code and copy into
my gadget container...  Which is why I asked (in another thread) if it could
be possible to package the servlets up into a JAR (possibly with as many as
a the core classes as needed).

I'd also rather not add a proxy servlet to my gadget container to make the
x-domain calls.

I'll reply to the other thread - as I think I have an answer to this
particular thread.

Martin

Re: Setting the gadgets height once loaded from the container

Posted by Kevin Brown <et...@google.com>.
On Sat, Mar 22, 2008 at 4:17 AM, Martin Webb <ma...@gmail.com>
wrote:

> Is this possible?  Can I get the gadgets actual height rather than the
> iframe height, and then set the iframe height to show the gadget in full?
>
> Several gadgets don't require the dynamic height feature, so the gadget
> server doesn't inject the dynamicHeight.js - and the container just shows
> the gadget using a default iframe height - is this the correct behaviour,
> shouldn't dynamicHeight.js always be injected into the gadget?  How is the
> container supposed to show the gadget in full?


Either:

Always create iframes that are larger than the gadgets they contain

or

Use the metadata APIs (/gadgets/metadata) to get the height specified in the
gadget.


> Regards
> Martin
> --
> Internet Related Technologies - http://www.irt.org
>



-- 
~Kevin