gpt4 book ai didi

javascript - 在 Facebook 上分享图片给我错误

转载 作者:行者123 更新时间:2023-11-28 00:56:30 26 4
gpt4 key购买 nike

我的脚本代码为:

<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.

这可能是什么错误?

我的应用详细信息是:

enter image description here

当我添加:

<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

希望这对您有帮助。

关于javascript - 在 Facebook 上分享图片给我错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26159305/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com