raj asked this 4 years ago

Custom Facebook share button without using SDK

I had a simple custom share button using sharer.php 

<a href="https://www.facebook.com/sharer/sharer.php?u=myurl.com" target="_blank">Share on FB</a>

The  new guidelines say I include Facebook SDK. I just want a simple share button and dont want to include facebook SDK. Is the sharer to be deprecated? Is there a simpler way to do it like before?

Fischer 4 years ago

Link to sharer.php is still working as of now (Feb 2017), but FB recommendation is to use share-dialog https://developers.facebook.com/docs/sharing/reference/share-dialog

To use this you have to register in facebook developers and get an app ID. Share button code using share-dialog looks like

<a href="https://www.facebook.com/dialog/share?app_id=145634995501895&display=popup&href=www.myurl.com/mypage.html" target="_blank"></a>