facebook-app:如何更改可调整大小的iframe应用程序的高度? [英] facebook-app: how can i change the height of a resizeable iframe application?

查看:153
本文介绍了facebook-app:如何更改可调整大小的iframe应用程序的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



IFrame大小:可调整大小
画布宽度:760px



似乎无论我如何配置我的html页面,iframe高度是800px。我的应用程序需要更多的,我如何配置Facebook应用程序的iframe有更大的高度?



谢谢!

解决方案

将Canvas Size选项设置为可调整大小的Iframe本身不会使画布自动调整大小以符合您的内容。还有几件其他事情你必须做。有关完整说明,请查看可调整大小的IFrame wiki页面。



您基本上必须创建一个被称为跨域接收器的HTML页面(就像复制和粘贴示例文件一样简单),然后复制一段Javascript代码在所有应用页面的底部。一旦内容加载,Javascript将执行iframe的大小调整。



自从上次使用Wiki页面以来,wiki页面有所改进,所以希望这是非常简单的。如果您遇到问题,请确保您检查您是否正确修改了JavaScript代码段,以便它指向您的跨域接收器页面。



<强> 2011年1月更新 - 有些评论进来,所以我以为我会更新。我相信这个答案或多或少是正确的,尽管文件已经改变了。 Facebook已经离开了FBML,并更新了JavaScript SDK。加载Javascript SDK的当前方法可以在主要Javascript SDK页面上找到,最下方是您可以用来调整画布大小的方法, FB.Canvas.setAutoResize() FB.Canvas .setSize()。您仍然需要在应用程序的开发人员设置中将画布设置为可调整大小。看起来他们可能已经取代了使用新SDK的跨域文件的需求,但是我还没有测试过。


I created a facebook app and i configured the following:

IFrame Size: Resizable Canvas Width: 760px (not using fbml)

it seems that no matter how i configure my html page, the iframe height is 800px. my application needs more then that, how can i configure the iframe of the facebook application to have a larger height ?

thanks!

解决方案

Setting your Canvas Size option to Resizable Iframe does not in itself make the canvas automatically resize to conform to your content. There's a couple of other things you have to do. Check out the Resizable IFrame wiki page for the full instructions.

You basically have to create an HTML page known as a "cross-domain receiver" (which is as simple as copying and pasting their example file), and then copy a snippet of Javascript code on the bottom of all your application pages. The Javascript will perform a resize of the iframe once the content has loaded.

The wiki page has improved since the last time I used it, so hopefully it's fairly straightforward. If you run into problems getting it working, make sure you check that you've modified the javascript snippet appropriately so that it points to your cross-domain receiver page.

Update Jan 2011 - Some comments coming in, so I thought I'd update. I believe this answer is still more or less correct, although the documentation has changed. Facebook has moved away from FBML, and updated their Javascript SDKs. The current method to load the Javascript SDK is found on the main Javascript SDK page, and at the bottom are the methods you can use for resizing the canvas, FB.Canvas.setAutoResize() and FB.Canvas.setSize(). You still need to set your canvas as resizable in the app's Developer settings. It looks like they may have replaced the need for a cross-domain file with the new SDK, but I haven't tested it yet myself.

这篇关于facebook-app:如何更改可调整大小的iframe应用程序的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆