7
votes

It's straightforward to use Facebook the Javascript SDK and FB.ui to trigger the "feed" dialog to share on your wall.

However, this shares on your wall with everyone. I'm looking for a way to share on a specific friend's wall and not finding any answers in the Facebook dev documentation.

I was about to give up but them saw this article written June 2011 which shows FB sharing UI that shows that you can change the scope of your sharing:

Screenshot of FB sharing dialog with scoping

I can't find any information that shows how to trigger this dialog that exposes those options. I've used this sample code from FB dev docs:

<html xmlns:fb="http://www.facebook.com/2008/fbml">
  <body>
    <script src="http://connect.facebook.net/en_US/all.js"></script>
    <div id="fb-root"></div>
    <script>
      // assume we are already logged in
      FB.init({appId: '1234567890', xfbml: true, cookie: true});

      FB.ui({
          method: 'feed',
           link: 'https://developers.facebook.com/docs/reference/dialogs/'
          });
     </script>
  </body>
</html>

However, this bring up a dialog that is essentially like the following. Notice no scoping options like the earlier screenshot:

enter image description here

Note: Even though I'm asking about the Javascript SDK and showing HTML, I ultimately I want to use the Facebook iOS SDK to share a link from my iOS app to an individual friend of the user that's logged into my app (while letting that user select which friend to share to).

2

2 Answers

1
votes

Our feed dialogs do not allow posting to another user's wall. To do this, I would suggest using our send dialog which allows the developer to specify the recipient user (end user can add additional users once the dialog is rendered).

It can be rendered via the graph api as such:

https://www.facebook.com/dialog/send?app_id=123050457758183&
name=People%20Argue%20Just%20to%20Win&
link=http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html&
redirect_uri=http://www.example.com/response
0
votes

As far as I know, the only place a dialog like that shows up is via the sharer.php endpoint, e.g. https://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.stackoverflow.com. That endpoint appears to have been deprecated (there's a Quora thread about it), but it's still functional for now.

It's possible the sharer dialog used to be available as a UI method, but as far as I can tell that's no longer the case, so opening up sharer.php in your app is the only way to show those scoping options. It's clunky in mobile browsers, however - your custom friend picker followed by a feed dialog is arguably a more attractive solution.