Facebook多次发布到墙
facebook multiple publish to wall
本文关键字:Facebook 更新时间:2023-09-26
我使用js SDK通过我在facebook上创建的应用程序从我的网站发布消息到朋友墙。上面的代码很好,当我张贴到单墙。问题我想张贴到多个墙在同一时间,没有弹出窗口或对话框出现相同的消息。我知道它必须通过循环来完成,但不能使它工作。
我的代码是
var publish =
{
method: 'stream.publish',
// display: 'popup',
attachment:
{
name: 'name' ,
caption: 'www.caption.com' ,
description: ('description'),
href: 'url',
media: [
{
type: 'image',
href: 'url',
src: 'url'
}
]
}
};
publish.target_id =id1;
FB.ui(publish);
publish.target_id = id2;
FB.ui(publish);
return false;
}
任何形式的帮助将不胜感激。
谢谢
由于:http://developers.facebook.com/policy/
5. You must not provide users with the option to publish more than one Stream story at a time.
你应该避免在同一时间把相同的消息发布到多个墙。
编辑:
但是如果你真的不想这么做:你不应该使用Fb.ui(),这是用于Facebook对话框。
你可以使用:
var body = 'Reading JS SDK documentation';
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
所以,你只需要循环你的userid,并用user_id替换"me"
最后我用下面的代码让它工作:
function doitonfacebook(){
var receivers = document.getElementById("selected-friends").innerHTML;
var temp = new Array();
temp = receivers.split(',');
var count =temp.length;
for (var i = 0; i < count; i++) {
var publish = {
method: 'stream.publish',
message: 'test',
picture : 'http://www.takwing.idv.hk/facebook/demoapp_jssdk/img/logo.gif',
link : 'http://www.test.com',
name: 'test',
caption: 'Caption of the Post',
description: 'testttttt',
actions : { name : 'testing', link : 'http://www.takwing.idv.hk/tech/fb_dev/index.php'}
};
FB.api('/'+temp[i]+'/feed', 'post',publish, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('success publishing: ' );
}
});
}}
感谢您的回复
相关文章:
- 使用php或javascript从facebook相册URL中删除多余的部分
- 漂亮照片图片库中的Facebook赞按钮
- 包括用于facebook评论框的JavaScript SDK
- 使用Facebook live API创建实时视频对象时的隐私设置
- 有任何可能将facebook实时信使整合到一个网站中
- facebook”;添加评论“;popup获胜'不要消失
- Facebook共享显示一个接一个的空白页面
- 使用acess代币登录Facebook,并通过网络应用程序离线发布
- 如何使用Spring MVC将Facebook返回的响应数据保存在Java类中
- 如何在Facebook上的iframe应用程序中使后退按钮返回到上一页
- 异步facebook功能
- Facebook登录按钮没有'不能在Firefox上工作
- 使用javascript反复检查用户在facebook上的登录状态
- 在我的SPA应用程序中集成Facebook共享的问题
- 点击facebook像素跟踪注册(JS/JQUERY代码)
- Facebook共享动态参数链接
- FB.login访问令牌facebook javascript SDK
- 如何检查用户已经登录facebook
- Facebook登录不适用于iOS的应用内浏览器
- 在类似Facebook的社交墙中添加href