Wednesday 7 March 2012

Facebook Share button

An example of the share button
The Share Button.

If you want to add a share button to your site all you need to do is add a small amount of script.
Simply add:

<a name="fb_share"></a> 
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" 
        type="text/javascript">
</script>
 
and you're done!

Look at the developer information for more details.

However it can sometimes go wrong and you don't see the text you expect.
According to Facebook, it scrapes your page every 24 hours to ensure the description (and other share data) are up to date. However, you can manually refresh it by entering the post URL into the Facebook URL Linter. Entering  your url onto this page will cause Facebook to update its cache of your page and you will get a diagnostic of what Facebook sees when they look at your page.

This would be great except Facebook are deprecating the share button in favour of like ...