[英]Avoid confirmation on FB.ui
请原谅我对javascript的不了解,但我有来自Facebook FB.ui的这段代码,我想知道我是否可以在按下“分享”按钮后最终避免确认? 我只是希望在用户按下共享后关闭弹出窗口,无论如何都没有确认。 这可能吗? 如果是这样,我该如何修改代码? 先感谢您。
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
link: 'https://developers.facebook.com/docs/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
caption: 'Reference Documentation',
description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
FB.ui
方法的函数参数是回调函数。 当FB.ui
完成它应该做的事情时调用它(在这里发布一个wallpost)
要摆脱确认,你只需要摆脱回调或让它为空。 但是,知道FB.ui
是否已成功完成它应该做的事情通常非常重要,例如检查用户是否未取消该操作。 这就是回调存在的原因。 你可以将它们变成你需要的任何东西。 无论如何,对话框将被关闭。
FB.ui({
method: 'feed',
name: 'Facebook Dialogs',
link: 'https://developers.facebook.com/docs/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
caption: 'Reference Documentation',
description: 'Dialogs provide a simple applications to users interface.'
},
function(response) {
if (response && response.post_id)
// Do whatever you need if the post is successfull
else
// Do whatever you need if the post failed
});
希望有所帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.