0

如果您的应用程序是网站,有什么方法可以发送应用请求?我在 facebook http://developers.facebook.com/bugs/182553325173000上报告了一个错误,但我不知道这是否可能

4

3 回答 3

2

是的,你可以通过添加 JS API 来做到这一点,

添加之前<body>

<script type="text/javascript">
    function inviteFriends(){
         var receiverUserIds = FB.ui({
                method : 'apprequests',
                message: 'YOUR CUSTOM MESSAGE',
         },
         function(receiverUserIds) {
                  console.log("IDS : " + receiverUserIds.request_ids);
                }
         );
    }
</script>

<body>包含 API(异步方法)之后:

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId  : 'YOUR APP ID',
      status : true, // check login status
      cookie : true, // enable cookies to allow the server to access the session
      xfbml  : true, // parse XFBML
      oauth  : true  //enables OAuth 2.0
    });
  };

  (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);
  }());
</script>

并称之为:

<a href="#"  onclick="inviteFriends(); return false;"></a>

或者

<a href="javascript:inviteFriends(); return false;"></a>
于 2011-12-12T12:02:14.303 回答
0

You can do that with the Javascript SDK

it is in the documentation: https://developers.facebook.com/docs/reference/dialogs/requests/

于 2011-12-12T11:49:51.163 回答
0

正如其他答案所示,这是可能的,但是当用户接受请求时,他们将被带到您的画布应用程序

于 2011-12-12T15:56:24.283 回答