Using the JavaScript SDK, FB.ui()
and feed
, you can offer your users to share the URL on Facebook. This dialog box presents the callback function so that you can determine if the post was successfully delivered.
Sample code taken from the specified link ...
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);
This is the easiest way to accomplish what you need. However, this will not allow you to test if someone shared the URL of your site outside of your feed
dialog.
A more sophisticated alternative that does not require a dialog callback can be accomplished using read_stream
permission. After you get this permission, you can scan users for previous messages to see if he shared your site on his wall ...
Keep in mind that this will not work if a user shares your site on some other wall or page ...
source share