0
我建立一個Facebook應用程序,其中包括此之後:帶圖片參數的FB.ui - Buggy?
<script>
window.fbAsyncInit = function() {
FB.init({
appId: 'HEREISMYAPPID',
xfbml: true,
version: 'v2.5'
});
};
(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>
現在我做了兩種方法。一個是共享文本,而不圖片,另一個是用圖片分享飼料:
function sharefbimage(imgUrl, title, desc, spruchbildid) {
FB.ui(
{
method: 'feed',
name: 'My App Name',
link: 'https://myurl.de/cdcd/'+spruchbildid,
caption: title,
description: desc,
picture: imgUrl
},
function (response) {
if (response && response.post_id) {
alert('success');
} else {
alert('error');
}
}
);
}
function sharefbtxt(spruch,spruchid) {
FB.ui(
{
method: 'feed',
name: 'My App Name',
link: 'https://myurl.de/cdcd/'+spruchid,
caption: 'This is the best caption ever',
description: spruch
},
function (response) {
if (response && response.post_id) {
alert('success');
} else {
alert('error');
}
}
);
}
如果我通過調用「sharefbtext」一切正常共享文本。如果我按取消按鈕彈出關閉,我得到響應警報。
如果我用「圖片」參數調用「sharefbimage」,對話框將按預期打開,圖像按預期加載。您可以發佈Feed並將其顯示在牆上。唯一不起作用的是,如果按下取消按鈕,它不會關閉對話框,所以響應警報從不顯示。按取消或交後,給料只重定向到「https://www.facebook.com/v2.5/dialog/feed」,但該對話框無法關閉......
所以我思念的東西或者這是一個錯誤?
這只是我重新加載頁面,什麼也不做...... –
@JanineKroser OK嘗試改變方法在你的代碼'feed'到'照片「# –
更改Feed中的照片時出現500錯誤。 –