2
votes

I used facebook share button without xfbml until yesterday. Yesterday I see that share button not working.

Until yesterday I was adding an anchor element with name fb_share only, facebook js-sdk convert the element to the the share button.

<div class="fb-share-con">
    <a type="button" name="fb_share">Share</a>
</div>

When I want to catch share event, I was assigning a function to click event of the "fb-share-con" div element and this had been working correctly(This callback method not good exactly but suffice me)

Now I do not know why but I cant use share button as above. js-sdk not convert the anchor to the share button.I was looking for fb share button usage on facebook developer page but I cant find anything about share button that work as above.

I found 2 method that works:

1 . Adding share button with fbml: I adding share button to the page with using fbml syntax , the share button working correctly but this time I cant assign a callback function( At least I dont know ).

<fb:share-button type="button"></fb:share-button>

2 . Use FB.ui : I am assigning a click event to the an html element that created by me and I am giving a callback function to the FB.ui() .I am sharing as feed but this not important. This method is so good but I am writing more code, Facebook does not create share button itself, so If I want to use share button I should make share button myself with css.

FB.ui({
  method: 'feed'
  ,link: window.location.href
  ,picture: Page.get("image")
  ,name: Page.get("title")
  ,caption: '...'
  ,description: Page.get("description")
  },function(r){
    console.log("page shared",r);
});

Questions:

  • Why my old method does not work no longer, this usage is deprecated ?
  • Can I assign a callback function to the fbml share button ?
  • Which method is best ?

I know little English.So I will be happy if you write in simple language. Thanks

1
This thread is discussing the usage of the share button in detail including an answer by a Facebook engineer working on the JavaScript SDK.borisdiakur

1 Answers

1
votes

Why my old method does not work no longer, this usage is deprecated ?

Facebook deprecated share button and functionality in favor of like and send buttons.

Can I assign a callback function to the fbml share button ?

You can't, also since the share functionality is deprecated you should avoid using it.

Which method is best ?

According to facebook, you should use like/send buttons.