开发者

Google Wave Gadget: gadgets.window is undefined

开发者 https://www.devze.com 2022-12-12 15:01 出处:网络
I\'m learning Google Wave gadgets. I\'m trying to force my gadget to resize itself. But I\'m keep getting error that gadgets.window is undefined.

I'm learning Google Wave gadgets.

I'm trying to force my gadget to resize itself.

But I'm keep getting error that gadgets.window is undefined.

Here is my gadget:

<?xml version="1.0" encoding="UTF-8" ?> 
<Module>
<ModulePrefs title="GitHub Gist Gadget">
  <Require feature="wave" /> 
  <!--Require feature="locked-domain" /-->
  <Require feature="dynamic-heights" />
</ModulePrefs>
<Content type="html">
<![CDATA[ 
<div id="content_div"> 

<input type=button onclick="gadgets.window.adjustHeight()" />

<script src="http://gist.github.com/244697.js"></script>

<script type="text/开发者_开发技巧javascript">
  gadgets.window.adjustHeight()
</script>

</div>
  ]]> 
  </Content>
</Module>

BTW, if you know about gadget to embed GitHub gists into Google Waves, please tell me. :-)


replace dynamic-heights with dynamic-height.

gadgets.window.adjustHeight() should be replaced with gadgets.util.registerOnLoadHandler(gadgets.window.adjustHeight), becouse gadgets.window may be not loaded while you initialize gadget.


For the same problem but with igoogle gadget design.

i found out that the gadgets.window object was only available in the sandbox, but you can use the igoogle function:

_IG_AdjustIFrameHeight();

that will automatically adjust the iframe, igoogle. ;)

source: http://code.google.com/p/opensocial-resources/issues/detail?id=572

0

精彩评论

暂无评论...
验证码 换一张
取 消