开发者

Facebook Invite Friends Box with iframes

开发者 https://www.devze.com 2023-03-13 14:30 出处:网络
I\'d like the Invite Friends Box on the bottom of my Landing Page in facebook. It worked with the old fbml but with iframes it doesn\'t show up. Here is the Code:

I'd like the Invite Friends Box on the bottom of my Landing Page in facebook. It worked with the old fbml but with iframes it doesn't show up. Here is the Code:

<div style="padding: 0px;"> <fb:request-form method="get" action="index.php" content="Fan" <fb:req-choice url='http://www.facebook.com/xyz' label='YES' />" t开发者_运维技巧ype="page" invite="true" rows="3"> <div class="clearfix" style="padding-bottom: 10px;"> <fb:multi-friend-selector condensed="false" style="width:520px;" showborder="black" actiontext="Invite your friends" rows="3" cols="3"/> </div> </fb:request-form> </div>

Any suggestions?


If you want FB invite friend in an iFrame you have to initiate the facebook Connect API first and for this we need XFBML initialization in the bottom of the page.

You should use fb:serverfbml tag to get fb:friend-selector working.

Here is the iFrame body

<fb:serverfbml style="width: 650px;"> 
<script type="text/fbml">
    <fb:fbml> 
        <fb:request-form
            action="http://your-site.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."
                exclude_ids="If any excluded Ids will goes here"
                rows="3"
            /> 
        </fb:request-form> 
    </fb:fbml>
</script> 
</fb:serverfbml>

The above script will display the invite friend iFrame.

Here is the FB.connect code

<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>
0

精彩评论

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