I have read that the Facebook sharer is deprecated, So I wanted to know how can I create a share button in my widget that will work from any domain (not just the app domain), via the js SDK (Preferably).
For example:
I have my app registered on myserver.com
And someone downloaded my widget on hisservers.com, I want the share to work from there and post to his wall.
How can I do so?
You can use the FB.ui Feed dialog to prompt the user to publish a story on their feed, and specify your link in the function. Like so
function postLink() {
var obj = {
method: 'feed',
link: 'http://myserver.com',
picture: 'a_picture',
name: 'My Server',
description: 'Sharing MyServer from HisServer.'
};
function callback(response) {
console.log(response['post_id']);
}
FB.ui(obj, callback);
}
Of course you'll have to also include the proper initialization for the JS SDK.