设置 Facebook 个人资料页面 iframe 选项卡的高度
据我们所知,Facebook 推出了页面 iframe 选项卡。我开发了一个应用程序,并在个人资料页面中添加了应用程序的选项卡,根据更新“页面的 iframe 选项卡”,应用程序选项卡在 iframe 中打开。问题是页面高度没有调整,无法去掉滚动条以显示没有滚动条的完整页面。我发现的所有解决方案都适用于应用程序画布页面,但不适用于应用程序选项卡页面。
我们怎样才能做到这一点?
As we know that Facebook has introduced iframe Tabs for Pages. I have developed an application and added the tab of the application in a profile page, application tab is opened in an iframe according to the update "iframe Tabs for Pages". The problem is that height of the page is not adjusted and unable to remove the scrollbars to display the fully page without scrollbars. All the solutions which I found work for the Application canvas page but not for the Application Tab page.
How can we do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
这很容易实现。您必须在 Facebook 集成选项卡中将应用程序设置为 IFRAME,并将框架的大小设置为 “自动调整大小”。
现在,在您的服务器上,您已经在
标记之前添加以下代码:
这将自动调整其大小。如果您将 overflow:hidden 添加到 BODY 标记,也会有所帮助。
It's quite easy to achieve. You have to set up the application in the Facebook Integration tab as an IFRAME and the size of the frame as "Auto-resize".
Now, on your server, you have to add the following code before the
</BODY>
tag:This will auto resize it. It also helps if you add overflow:hidden to the BODY tag.
以下指南帮助我解决了同样的问题:
http ://www.hyperarts.com/blog/facebook-iframe-apps-getting-rid-of-scrollbars/
简而言之,请执行以下操作:
将“IFrame 大小”更改为“自动调整大小”
加载 Facebook 的 Javascript SDK
在索引页的
标记之前添加以下代码:
将以下代码放在
标记之前:
应该可以了,希望有帮助!
The following guide helped me through the same problem:
http://www.hyperarts.com/blog/facebook-iframe-apps-getting-rid-of-scrollbars/
In short, do the following:
Change your "IFrame Size" to "Auto-resize"
Load Facebook's Javascript SDK
add the following code just before the
</body>
tag of your index page:Put the following code before the
</head>
tag:That should do it, hope it helps!
facebook 最近更改了一些内容,现在您的选项卡文件也需要
fb.init
方法。否则调整大小将不起作用。所以也可以在你的标签页中使用它facebook recently changed something, now your tab file also needs the
fb.init
method. otherwise the resize wont work. so use this in your tab page as well为遇到问题的每个人更新了代码:
1) 将应用程序的“画布高度”设置为“流体”。
2) 在关闭 之前复制并粘贴以下代码标签。
Updated code for everyone having issues:
1) Set your application "Canvas Height" to "Fluid".
2) Copy + paste the following code before the closing <body> tag.
嘿伙计们...我也遇到了问题...我尝试了无数的解决方案和建议,但它们从未对我有用。在我将 jquery 库 1.6 更改为 1.5.1 后,它就可以工作了。检查这是否是您的问题。
现在我想知道为什么它不能与 1.6 版本的 jquery 一起工作。
Hey guys... I was having problems with it as well.. i have tried a myriad of solutions and suggestions and they never worked for me. After I changed the jquery library 1.6 to the 1.5.1 it worked. Check if that is your problem.
Now I am trying to know why the hell it does not work with the version 1.6 of jquery.
对于像我这样尝试了上述所有方法均无效的人,这就是最终对我有用的方法。取自此页面: https://www.facebook.com/note.php?note_id= 10150149060995844
在
之前:
然后在
之前:
For anyone like me who tried all of the above to no avail, here's what finally worked for me. Taken from this page: https://www.facebook.com/note.php?note_id=10150149060995844
Before
</head>
:Then before
</body>
: