6

I need to pass some AngularJS variables from my application to the new Facebook sharer button, I'm using:

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/es_LA/all.js#xfbml=1&appId=1438439249728371";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

And this:

 <div class="fb-share-button" data-href="http://mySite" data-type="button">     </div>

Where can I place my custom text to share in the dialog?

Thank you!

Sahil Mittal
  • 20,697
  • 12
  • 65
  • 90
mdv
  • 925
  • 3
  • 14
  • 28

2 Answers2

13

Sharer wont allow that. It'll fetch the og tags from the link and fill the contents in the dialog.

If you want to add cutomized description/picture/caption you should instead use Feed Dialog.

You can use the direct URL to invoke feed dialog:

https://www.facebook.com/dialog/feed?
 app_id=1438439249728371
 &display=popup
 &caption={caption}
 &link={link-to-share}
 &description={description}
 &redirect_uri={redirect-url-to-your-site}

You can check all available parameters here

Sahil Mittal
  • 20,697
  • 12
  • 65
  • 90
  • Thank you so much, I was using the wrong widget, do you know some tutorial to integrate the feed dialog in a website? – mdv Apr 13 '14 at 21:03
  • I've mentioned the link in the answer already : https://developers.facebook.com/docs/sharing/reference/feed-dialog :) – Sahil Mittal Apr 13 '14 at 21:03
  • Im getting this error: API Error Code: 100 API Error Description: Invalid parameter Error Message: You are using display type "popup " on the domain "www.facebook.com", which is invalid. You should access a different domain (m.facebook.com, www.facebook.com), or use one of the following supported display types: page, popup, iframe with the popup parameter, any ideas why? If I remove it everything works fine – mdv Apr 13 '14 at 22:45
  • This may work for the time being but the Feed Dialog has been deprecated so you should instead rely on the Share Dialog with OpenGraph tags. – Pier-Luc Gendreau Oct 21 '14 at 19:39
0

If you use the Facebook SDK for JavaScript you have to use the parameter quote

  FB.ui({
    method: 'share',
    display: 'popup',
    href: window.location.href,
    quote: "Your Custom Text"
  }, function(response){});
Ivan Belchev
  • 643
  • 7
  • 6