发布在用户facebook墙上

问题描述:

我正在建立的网站的用户应该能够在他们的Facebook墙上发布一个标题,一张图片和一个链接。

The users of the website I'm building should be able to publish a title, a picture and a link on their facebook wall.

我发现很多问题主题,但没有体面的答案...

I found many questions on the subject, but no decent answer...

我发现最简单的方法是使用JavaScript SDK:
http://developers.facebook.com/docs/reference/javascript/

The easiest way I've found is to use the JavaScript SDK: http://developers.facebook.com/docs/reference/javascript/

http: //developers.facebook.com/docs/reference/javascript/FB.ui/

加载:

<div id="fb-root"></div>
<script>
  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);
}());
</script>

在您的JavaScript文件中使用FB.ui方法(相应填写您的数据):

Use the FB.ui method in your JavaScript file (fill in your data accordingly):

FB.ui(
   {
     method: 'feed',
     name: 'Facebook Dialogs',
     link: 'http://developers.facebook.com/docs/reference/dialogs/',
     picture: 'http://fbrell.com/f8.jpg',
     caption: 'Reference Documentation',
     description: 'Dialogs provide a simple, consistent interface for applications to interface with users.',
     message: 'Facebook Dialogs are easy!'
   },
   function(response) {
     if (response && response.post_id) {
       alert('Post was published.');
     } else {
       alert('Post was not published.');
     }
   }
);