我无法运行 Facebook UI 回调。我使用了来自 FB 开发站点的示例:
https://developers.facebook.com/docs/reference/dialogs/feed/
FB.init({appId: "YOUR_APP_ID", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
redirect_uri: 'YOUR URL HERE',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
当我在我的网站上运行它时,我没有收到任何回调 https://www.ipassexam.com/page/fb-test
如有任何见解,我们将不胜感激。
最佳答案
去掉 redirect_uri 参数。这每次都对我有用:
FB.ui({
method: 'feed',
link: "http://...",
name: "Some Title",
caption: "Some Caption",
description: "Some Description",
picture: "http://..."
}, function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
});
还要确保控制台中没有错误。但无论如何我没有看到任何错误。
关于javascript - FB.ui 没有回调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14095146/