本文介绍了使用Facebook图表简单地发布一个墙上的消息,只是javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我真的不会在Facebook上发布消息到用户的墙上说我在对象游戏中打8/10想要使用完整的API,因为我不想处理用户登录的详细信息。我不介意,如果Facebook需要验证,然后发布消息。



可以使用新的Graph API和JavaScript吗?

解决方案

注意4/16/2011: stream.publish似乎已被弃用,有一种新的方式来执行此操作:



您可以使用这样的东西发布到墙上,用户在发送之前需要确认。
不要忘记你需要使用FB.init并包含JS SDK链接。

 函数fb_publish(){
FB.ui(
{
method:'stream.publish',
message:'Message here。',
attachment:{
name:'Name here',
caption:'Caption here。',
description:(
'description here'
),
href:'url这里'
},
action_links:[
{text:'Code',href:'action url here'}
],
user_prompt_message:'个人信息'
},
function(response){
if(response&& response.post_id){
alert('Post was published。');
} else {
alert('Post was not published。');
}
}
);
}


In Facebook how can I post a message onto a user's wall saying "I scored 8/10 on objects game" then a URL?

I really don't want to have to use the full API, as I don't want to handle user login details. I don't mind if Facebook needs to authenticate and then post the message.

Is it possible using the new Graph API and JavaScript?

解决方案

Note 4/16/2011: stream.publish seems to have been deprecated, There's a new way to do this: http://developers.facebook.com/docs/reference/dialogs/feed/

You can use something like this to publish to a wall, the user will need to confirm before it get sent.Don't forget that you'll need to use FB.init and include the JS SDK link.

 function fb_publish() {
     FB.ui(
       {
         method: 'stream.publish',
         message: 'Message here.',
         attachment: {
           name: 'Name here',
           caption: 'Caption here.',
           description: (
             'description here'
           ),
           href: 'url here'
         },
         action_links: [
           { text: 'Code', href: 'action url here' }
         ],
         user_prompt_message: 'Personal message here'
       },
       function(response) {
         if (response && response.post_id) {
           alert('Post was published.');
         } else {
           alert('Post was not published.');
         }
       }
     );  
  }

这篇关于使用Facebook图表简单地发布一个墙上的消息,只是javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 02:50