ctc8631
ctc8631

Reputation: 171

Can I post a message to facebook wall in my website?

I use the html code in facebook developer but it can't post the message I put in the website there just appear a windows that you can enter some words but the 'Facebook for Websites is super-cool' doesn't appear in the window (just like the website did)

I have applied a appid, is there anything wrong?

<html>
<head>
  <title>My Facebook Login Page</title>
</head>
<body>
  <div id="fb-root"></div>
  <script>
    window.fbAsyncInit = function() {
      FB.init({
        appId      : 'YOUR_APP_ID',
        status     : true, 
        cookie     : true,
        xfbml      : true
      });

      FB.ui({ method: 'feed', 
          message: 'Facebook for Websites is super-cool'});
    };

    (function(d){
       var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
       js = d.createElement('script'); js.id = id; js.async = true;
       js.src = "//connect.facebook.net/en_US/all.js";
       d.getElementsByTagName('head')[0].appendChild(js);
     }(document));
  </script>

</body>

Upvotes: 0

Views: 2420

Answers (4)

Woo Lei
Woo Lei

Reputation: 31

I would suggest you to use the facebook comment plugin instead. It free and easy to implement.

if the user really like your page, they will write something good to you.

Do check out my website -> www.wootube.woolei.com

Upvotes: 0

Marek Roj
Marek Roj

Reputation: 1241

According to this facebook platform update, since July 12 the message field is no longer supported.

Upvotes: 2

enthusiastic
enthusiastic

Reputation: 1702

<div id="fb-root"></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p><a onclick='postToFeed(); return false;'>Post to Feed</a></p>
<p id='msg'></p>
<script>
FB.init( {
    appId : "YOUR_APP_ID",
    status : true,
    cookie : true
});

function postToFeed() {

    // calling the API ...
    var obj = {
        method : 'feed',
        link : 'https://developers.facebook.com/docs/reference/dialogs/',
        picture : 'http://fbrell.com/f8.jpg',
        name : 'Facebook Dialogs',
        caption : 'Reference Documentation',
        description : 'Using Dialogs to interact with users.'
    };

    function callback(response) {
        document.getElementById('msg').innerHTML = "Post ID: "
                + response['post_id'];
    }

    FB.ui(obj, callback);
}

I suggest you to go through the documentation first...

Upvotes: 0

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

You need to do:

var params = {};
params['message'] = 'Message';
params['name'] = 'Name';
params['description'] = 'Description';
params['link'] = 'http://apps.facebook.com/summer-mourning/';
params['picture'] = 'http://summer-mourning.zoocha.com/uploads/thumb.png';
params['caption'] = 'Caption';

FB.api('/me/feed', 'post', params, function(response) {
  if (!response || response.error) {
    alert('Error occured');
  } else {
    alert('Published to stream - you might want to delete it now!');
  }
});

Ref link: http://daipratt.co.uk/using-fb-api-to-make-a-full-post-to-a-users-wall/

Hope it helps

Upvotes: 0

Related Questions