我可以在iframe中使用Facebook的fb:friend-selector吗? [英] Can I use Facebook's fb:friend-selector in an iframe?

查看:83
本文介绍了我可以在iframe中使用Facebook的fb:friend-selector吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Facebook的 fb:friend-selector FBML标签,但我的应用程序正在运行iframe。是否可以在iframe中使用此标签?如果有的话,有没有例子?

I'm trying to use Facebook's fb:friend-selector FBML tag, but my application is running in an iframe. Is it possible to use this tag in an iframe? If so does anyone have any examples?

推荐答案

是的,这绝对是可以的,但你必须使用 Facebook Connect XFBML 。具体来说,您要使用 fb:serverfbml 标记来获取fb:朋友选择工作。我有一个iframe应用程序,我使用所有这些和fb:friend选择器在标准邀请朋友到你的应用程序上下文,它的效果很好。

Yes, this is definitely possible, but you have to use Facebook Connect and XFBML. Specifically, you want to use the fb:serverfbml tag to get fb:friend-selector working. I have an iframe app whereby I use all of this and the fb:friend-selector in the standard "invite friends to your app" context, and it works great.

这是我的模板文件的主体,它在我的iframe的主体内部输出:

Here is the body of my template file, which gets output inside the body of my iframe:

<fb:serverfbml style="width: 650px;"> 
<script type="text/fbml">
    <fb:fbml> 
        <fb:request-form
            action="http://example.com/invite/sent"
            method="POST"
            invite="true"
            type="My App"
            content="Try out my app!
                <fb:req-choice url='http://your-facebook-canvas-url'
                label='<?php echo htmlspecialchars("Accept button text",ENT_QUOTES); ?>'
                /> 
            " > 
            <fb:multi-friend-selector
                showborder="false"
                actiontext="Invite your friends to try My App."
                exclude_ids="<?php echo $excludeIds; ?>"
                rows="3"
            /> 
        </fb:request-form> 
    </fb:fbml>
</script> 
</fb:serverfbml>

在页面的页脚中,我有标准的Facebook Connect代码,它将加载和呈现fb:serverfbml内容:

In the footer of the page, I have the standard Facebook Connect code, which will load and render the fb:serverfbml contents:

<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<script type="text/javascript">
    FB_RequireFeatures(
        ["CanvasUtil"],
        function(){
             FB.XdComm.Server.init('/xd_receiver.html');
             FB.CanvasClient.startTimerToSizeToContent();
        }
    );
</script>

<script type="text/javascript">
    FB_RequireFeatures(["XFBML"], function(){ FB.Facebook.init("Your Facebook API Key", "/xd_receiver.html"); });   
</script>

这应该是您需要的(当然,请在适用的情况下填写您自己的选项)。您必须设置Facebook Connect才能使用跨域接收器文件。我建议您遵循呈现XFBML步骤

That should be all you need (fill in your own options where applicable, of course). You'll have to set up Facebook Connect to work with a cross-domain receiver file. I suggest following the rendering XFBML steps.

这篇关于我可以在iframe中使用Facebook的fb:friend-selector吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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