使用fb.ui张贴到页面墙
-
08-10-2019 - |
题
我在用着 FB.ui
发布到Facebook用户墙上。但是,我不确定要使用哪些参数发布到页面或应用程序墙。有链接吗?
我想张贴到页面墙 如那个页面, ,不是用户的帐户。
向用户帐户发布的代码:
FB.ui(
{
method: 'feed',
name: name,
link: link,
picture: picture,
caption: caption,
description: redemption,
message: message
},
function (response) {
if (response && response.post_id) {
alert(response.post_id);
} else {
}
}
);
解决方案
知道了:
您必须设置 to
和 from
值:
FB.ui( {
method: 'feed',
name: name,
link: link,
picture: picture,
caption: caption,
description: redemption,
message: message,
to: page_id,
from: page_id
},
function (response) {
if (response && response.post_id) {
alert(response.post_id);
} else {
}
}
);
其他提示
我使用JavaScript SDK在用户的墙上发布:
function graphStreamPublish(){
var body = document.getElementById("txtTextToPublish").value;
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
}
当我经历 图API页 我想如果你改变 '/me/feed/'
至 'pageId/feed'
然后,它可以在该页面中发布消息。我不知道。 - 只是一个建议。
截至2012年2月,在朋友的墙上分享:
FB.ui({
method: 'stream.publish',
app_id: appId,
display: 'iframe',
name: name,
link: link,
picture: picture,
caption: caption,
description: description,
target_id: friendIds
});
发布到Facebook墙上使用以下内容。
使用以下简单调用来调用下面的JS函数
<a href="#" onclick="publishWallPost()">Post to Wall image/text?</a>
//facebook: post to wall
function publishWallPost() {
FB.ui({
method: 'feed',
name: 'Your App Name',
caption: 'Caption Text',
description: 'Your description text',
link: 'https://www.facebook.com/link/link.link',
picture: fbImg
},
function (response) {
console.log('publishStory response: ', response);
});
return false;
}
window.fbAsyncInit = function () {
FB.init({
appId: 'Your App ID',
status: true,
cookie: true,
xfbml: true
});
};
(function () {
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
抱歉,这是一个古老的问题,但我认为这可能对通过Google找到它的人有所帮助。http://fbmhell.com/2011/07/facebook-share-popup-iframe-tabs-jquery/
只需记住target_id需要分解为int。响应[“ to”]作为字符串返回。
不隶属于 StackOverflow