Sharrre
Sharrre copied to clipboard
Add enableFeedDialog parameter to Facebook button
I added a parameter named "enableFeedDialog" to the Facebook button which will open a Feed Dialog (https://developers.facebook.com/docs/reference/dialogs/feed/) instead of open a popup pointing to the sharer.php which is deprecated.
I was trying out this and got the error says: FB is not defined.
Please notice that app_id and redirect_uri are required.
https://developers.facebook.com/docs/reference/dialogs/feed/
also says "You can also bring up a Feed Dialog by explicitly directing the user to the /dialog/feed endpoint"
see the Direct URL Example
FB is not defined because you didn't initialize it before ? It's strange that you got an error, my test look that FB is defined before calling it.
In my web app with FB initialized all is OK.
You're right about the dialog/feed endpoint but the feed build by the ui method is directly shown in the current page.
Maybe I can open this endpoint if FB is undefined ?
I just tried to use the link directly and it worked. Check out digg.com and all the FB feed dialog links are using the direct links with a redirect_uri which contains javascript window.close.
Ok so I think that I can improve my pull request by adding a parameter to control the way the feed dialog is displayed (FB.ui vs direct link).
As you suggested, we can also add this simple self-closing page.
Are you OK with that ?
That would be great! I customized mine yesterday and added app_id and redirect_uri for the users to define, so that they don't have to hard code them in the plugin, for example:
buttons: {
facebook: {
enableFeedDialog: true,
app_id: '',
redirect_uri: 'http://www.yourdomain.com/fbshare_self_colse'
}
}
There are many other ways to do this, totally up to you.
Happy Xmas!