我试图让用户能够在我的外部网站上发布他们的Facebook墙.
我在Safari中遇到了问题.如果用户未登录,即他们没有通过调用FB.login()的流程,则在调用FB.ui()时会出现以下JS错误:
TypeError:'undefined'不是对象(评估'b.fbCallID = a.id')
但是,如果他们已登录,则对话框显示正常.
在回调函数中调用FB.ui() - 我从服务器检索一个唯一的url,然后调用FB.ui().如果我直接调用FB.ui(),它可以正常工作,但不是异步时.
这是代码:
retrieveUrl(param1, param2, function(result) {
FB.ui({ method: 'feed',
description: 'My Description',
display: 'dialog',
link: result.uniqueUrl,
picture: 'http://foo.com/bar.jpg'
}, function(response) {
if (response && response.post_id) {
//Posted message
} else {
//Not posted message
}
});
});
Run Code Online (Sandbox Code Playgroud)
这适用于其他浏览器,无论是否登录状态.