Facebook like and share button with callback

前端 未结 4 1119
闹比i
闹比i 2020-12-04 16:03

I have a webpage where I have placed a Facebook like & share button and corresponding javascript callback functions are also present.

Now the problem is, the jav

4条回答
  •  天涯浪人
    2020-12-04 16:40

    You cannot get the share callback using this like button. You can instead create a share button of yours and invoke the Feed Dialog on its click-

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

提交回复
热议问题