0

我正在使用以下代码向我的 facebook 朋友发送邀请,但它会打开请求弹出窗口,但我的朋友没有收到邀请:

<div>
    <div id="fb-root">
    </div>
    <script src="http://connect.facebook.net/en_US/all.js">

if (top.location != self.location) { top.location = self.location }

        FB.init({
            appId: 'my_app_id',
            cookie: true,
            status: true,
            xfbml: true
        });

        function FacebookInviteFriends() {
            FB.ui({
                method: 'apprequests',
                message: '9lessons Programming Blog Topics focused on Web Programming.'
            });
        }
    </script>
    <a href='#' onclick="FacebookInviteFriends();">Facebook Invite Friends</a>
</div>

我正在关注此链接来执行此操作。

请帮我。请帮我找出我做错的地方。这是我的应用程序设置的屏幕截图在此处输入图像描述

4

1 回答 1

0

我什么也没做,只是“让我的应用退出沙盒模式”并将页面上传到 Live 网站。它在那里工作正常。我认为 facebook 无法从本地主机发送邀请。所以这是我用来从 facebook 发送邀请的代码:

 <div id="fb-root">
</div>
<a href="#" onclick="FbRequest('If you want to fulfill your wishes then do not miss the opertuanty, huury up and join WishIsDone, A platform where you can fulfill your as well as your friends wishes...!','609416079110673');">
    Send Request</a>
<script type="text/javascript">
    function FbRequest(message, data) {
        FB.ui({ method: 'apprequests', message: message, data: data, title: 'Share this site with your friends' },
            function (response) {
                // response.request_ids holds an array of user ids that received the request
                var receiverIDs;
                if (response.request) {
                    var receiverIDs = response.to;  // receiverIDs is an array holding all user ids
                    alert(receiverIDs);
                }
            }
    );
    }
    // typical application initialization code for your site
    (function () {
        var e = document.createElement('script');
        e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
    } ());
    window.fbAsyncInit = function () {
        FB.init({
            appId: 'app_Id',
            session: {},
            status: true,
            cookie: true,
            xfbml: true
        });
    };
</script>

就是这样,感谢所有回答我问题的人。

于 2013-10-12T09:23:02.920 回答