所以,我试图让 Facebook Feed Dialog 通过他们的 API 工作,但到目前为止还没有成功。
我正在使用 Facebook Javascript SDK 和 FB.ui 方法来做到这一点。
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'MY FB APP ID',
xfbml : true,
version : 'v2.3'
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<script type="text/javascript">
function fbShare(url, title, descr, image) {
FB.ui({
method: 'feed',
name: title,
link: url,
caption: 'Title',
description: descr,
picture: image,
display: 'popup',
redirect_uri: url
},
function(response) {
if (response && response.post_id) {
//alert('Post was published.');
} else {
//alert('Post was not published.');
}
});
}
</script>
这是我的链接的样子:
<a href="javascript:fbShare('http://mywebsite.com/avaliacao/9d8ee3cb3ad759b134da94802e7c49c8', 'My Site Has a new share', 'Lorem ipsum is a pseudo-Latin text used in web design, typography, layout, and printing in place of English to emphasise design elements over content.', 'http://mywebsite.com.br/img/fb-share.png')">Share</a>
单击共享链接时出现的错误:
发生错误。请稍后再试。
API 错误代码:191。
API 错误描述:指定的 URL 不属于应用程序。
错误消息:redirect_uri 不属于应用程序。”