Facebook向多个用户发送消息

时间:2013-02-19 13:24:45

标签: javascript facebook-javascript-sdk

我想向多个用户发送消息。我不知道我做错了什么。

但它只能运行JavaScript Test Console。

这是我的代码:

<html>
<body >
    <div id="fb-root"></div>
    <script src="http://connect.facebook.net/en_US/all.js"></script>
    <script>
        window.fbAsyncInit = function() {
            FB.init({
                appId      : 'MY APP ID',
                status     : true, // check the login status upon init?
                cookie     : true, // set sessions cookies to allow your server to access the session?
                xfbml      : true,  // parse XFBML tags on this page?
                oauth: true // enable OAuth 2.0

            });
        };

        (function(d, debug){
            var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
            if (d.getElementById(id)) {return;}
            js = d.createElement('script'); js.id = id; js.async = true;
            js.src = "//connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js";
            ref.parentNode.insertBefore(js, ref);
        }(document, /*debug*/ false));

        function sendmsg(){
            FB.ui({
                method: 'send',
                to: ['100000793830311','100002551899151'],
                name: 'test msg',
                link: 'http://www.google.com'
            });
        }    
    </script>

    <button onclick="sendmsg();">SEND</button>
</body>

1 个答案:

答案 0 :(得分:0)

方法send不允许to字段中包含多个用户ID。 代码只允许一个id。用户可以在对话框中输入其他收件人。

相关问题