我正在使用Facebook发送对话框将消息发送给 friend 。如此处所述:https://developers.facebook.com/docs/reference/dialogs/send/,并且正在使用类似于Facebook示例中的链接的链接:https://www.facebook.com/dialog/send?app_id=123050457758183&name=People%20Argue%20Just%20to%20Win&link=http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html&redirect_uri=http://www.example.com/response
在我已指定为redirect_uri
的页面上,我正在显示文字:“您的消息已发送”。但是,我意识到即使您在Facebook对话框中单击“取消”,也可以看到此页面。
有什么方法可以确定是否单击了保存或取消?
更新:我找到了使用FB.ui方法的解决方法,该方法解决了我遇到的直接问题。我仍然想知道是否有人可以使用上面的“发送对话框”链接找到更好的解决方案。
最佳答案
通过使用Facebook的Javascript SDK的FB.ui方法,我找到了解决方法。
FB.ui({
method: 'send',
name: 'People Argue Just to Win',
link: 'http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html,
display: 'popup'
});
N.B.必须将显示设置为弹出窗 Eloquent 能起作用!
因为它不需要
redirect_uri
,所以知道是否单击了保存或取消的问题不是问题。但是,如果您确实想知道这一点,则可以访问响应对象: FB.ui({
method: 'send',
name: 'People Argue Just to Win',
link: 'http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html,
display: 'popup'
},
function(response) {
if (response){
// save has been clicked
} else {
// cancel has been clicked
}
});
关于javascript - Facebook发送对话框,确定是否已单击发送或取消,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6705662/