Log in

View Full Version : Share on Facebook



me_myself
03-29-2010, 09:47 PM
I have a website (static html) which has a title and article below (something like a news section) - i need to place the "Share on Facebook" below each article - when i click on it, the facebook popup should load that articles title and a snippet from that article. Currently i used the code below - it picks up the title and decription from the page and not from the article within the page. Please let me know how to customize it.

<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><a rel="nofollow" href="http://www.facebook.com/share.php?u=<url>" onclick="return fbs_click()" target="_blank">Share on Facebook</a>

Thanks.
(The client wants this section in static html and not in wordpress or joomla)

Nile
03-29-2010, 09:51 PM
A link to the page would be nice. :)

me_myself
03-29-2010, 10:05 PM
Here's a sample page -

http://www.baselinetennisacademy.com/facebook_test.html

Thanks

Nile
03-29-2010, 10:45 PM
Nothing shows in the text box when I attempt to share it on facebook,

me_myself
03-30-2010, 01:56 PM
Yep - i need to know how to add the title and the snippet from each article when the 'share on facebook' is clicked on the corresponding article.

Thanks.

Nile
03-30-2010, 03:34 PM
Add to the end of the URL:


%title=BlahBlahBlah

me_myself
03-30-2010, 03:39 PM
I am not sure where to put the code (%title=BlahBlahBlah) - Can you please use it in this code - Thanks

<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><a rel="nofollow" href="http://www.facebook.com/share.php?u=<url>" onclick="return fbs_click()" target="_blank">Share on Facebook</a>

Nile
03-30-2010, 06:27 PM
Sorry - I was wrong. The text on facebook is the value of the meta discription:


<meta name="description" content="A Seal eats a Cow?">