Creating a facebook share button on your Website and Blog

2,641

May 4, 2011 by admin

Creating a facebook share button on a website or a facebook page.

Normally the javascript and code

[php]
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:share-button type="" href=""></fb:share-button>
[/php]

But does not work all the time.

This code will work on any website

[php]
<a name=”fb_share”></a>
<script src=”http://static.ak.fbcdn.net/connect.php/js/FB.Share” type=”text/javascript”>
</script>
[/php]

This code also works on pages using the facebook page builder  Static XFBML : Custom tab builder

Because we didn’t specify the type and share_url attributes, the button defaults to the button_count type and shares the URL of the page where you placed it.

Styling Your Share Button

If you want, you can choose from a variety of styles for your Share button. Below are ways you can style your share button

1. (57×57 pixels)

[php]

<a name=”fb_share” type=”box_count” share_url=”YOUR_URL”></a>
[/php]

2. (18×15 pixels)

[php]

<a name=”fb_share” type=”icon” share_url=”YOUR_URL”></a>
[/php]

3. (56×18 pixels)

[php]
<a name=”fb_share” type=”button” share_url=”YOUR_URL”></a>
[/php]

4. (96×18 pixels)

[php]

<a name=”fb_share” type=”button_count” share_url=”YOUR_URL”></a>
[/php]

5. (51×15 pixels)

[php]

<a name=”fb_share” type=”icon_link” share_url=”YOUR_URL”>Share</a>
[/php]

The like button is gradually taking the place of share in terms of its functionality and popularity.

What do you think?