[英]Share Image on facebook giving me error
我的腳本代碼為:
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '878892922141778',
xfbml : true,
version : 'v2.1'
});
};
(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 publishOnFacebook() {
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
link: 'https://apps.facebook.com/878892922141778',
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.');
}
}
);
}
</script>
共享按鈕為:
<a hre="#" onclick="publishOnFacebook();" data-share="fb"><span class="fb-icon"></span></a>
但是,當我單擊共享按鈕時,它給了我錯誤:
API Error Code: 191 API Error Description: The specified URL is not owned by the application Error Message: redirect_uri is not owned by the application.
可能是什么錯誤?
我的應用程序詳細信息是:
當我添加時:
<a href="javascript:void(o);"
onclick="window.open('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href),'facebook-share-dialog', 'width=626,height=436');
return false;">
SHARE
</a>
它共享整個頁面。 但是我只想共享特定的圖像。
請幫我。
如果您還想共享圖片,則可以在FB.ui方法中使用該代碼
picture: 'https://apps.facebook.com/test.png' // your image path
希望對您有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.