我想在不使用FBML标签的情况下向我们的朋友列表发送Facebook好友邀请(<fb:request ....)
我正在使用fbServices在ASP.NET中编写代码.
如何在不使用FMBL标签的情况下发送好友请求?
我花了很多时间观察,最后得到了一个非常简单的解决方案.
使用Facebook Javascript API,您可以通过以下方式执行朋友请求:
<script>
FB.ui(
{
method: 'friends.add',
id: fbid // assuming you set this variable previously...
},
function(param){
console.log(param);
// If they cancel params will show:
// {action:false, ...}
// and if they send the friend request it'll have:
// {action:true, ...}
// and if they closed the pop-up window then:
// param is undefined
}
);
</script>
Run Code Online (Sandbox Code Playgroud)
然后,回调脚本可以简单地对您的服务器执行ajax调用,如果需要,您可以在其中保存有关操作的信息.
您可以使用Facebook上的javascript控制台应用程序对此进行测试:
http://developers.facebook.com/tools/console
粘贴上面的脚本,包括标签,或单击文本区域底部的"示例"按钮,找到"fb.ui - friends.add"示例.
| 归档时间: |
|
| 查看次数: |
22833 次 |
| 最近记录: |