Marcin Bobowski
Marcin Bobowski

Reputation: 1775

Facebook share with custom text on button

It used to be done this way:

<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
<a type="button_count" share_url="http://google.pl" name="fb_share">Share this page on Your's wall</a>

And it used to generate a share button with text "Share this page on Your's wall" instead normal "Share". Since last update it doesnt work anymore. Is there any posibillity to change the text on share button?

Upvotes: 1

Views: 5768

Answers (1)

aaaaaa
aaaaaa

Reputation: 2618

With Facebook JS SDK:

You now have to use the Feed Dialog, which is part of the Facebook JavaScript SDK.


Without Facebook JS SDK:

If you don't want to be bothered with their SDK, you can use this simple link instead:

<a href="https://www.facebook.com/dialog/feed?app_id=140586622674265&link=[[URL]]&name=[[TITLE]]&redirect_uri=http%3A%2F%2Fs7.addthis.com%2Fstatic%2Fpostshare%2Fc00.html" target="_blank">Share this page on your wall</a>

Here's what it'll look like if you're sharing Google.com with this link: https://www.facebook.com/dialog/feed?app_id=140586622674265&link=http%3A%2F%2Fgoogle.com&name=Google&redirect_uri=http%3A%2F%2Fs7.addthis.com%2Fstatic%2Fpostshare%2Fc00.html

Also, please acknowledge these three things:

  • You need to replace [[URL]] and [[TITLE]] with a link to the page you want to share and its title (both url-encoded).
  • The Feed Dialog has to show from which Facebook app the post comes from. The app_id parameter in the URL above is the one from AddThis. Create a Facebook app and put its own id in the URL to use the name you want instead of "AddThis Sharing". You can keep the app_id from AddThis though, it works just fine.
  • The last parameter (redirect_uri) is the page where the user will be redirected after sharing. It's currently a page from AddThis with some JavaScript that will close the tab / window. That way, the dialog just disappears when it's not needed anymore. You don't have to change it either, works great.

Upvotes: 4

Related Questions