Facebook Share Button (Dynamic url) - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Facebook Share Button (Dynamic url)

stoxicstoxic Posts: 1Member

I have been working on a facebook share button for my website for three days now and I am having a hard time to get it work.

I tried several things and I think I am close. Below, I post the code I use. If you thing you understand what my error is please let me know. Also I have posted a screenshot of the share window in which the meta information is missing.

On the image you can see that the meta tags are not presented. e.g the title, description, etc.

The code :


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;}" onclick="return fbs_click()" target="_blank">Share on Facebook


I also included JavaScript SDK


(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'facebook-jssdk'));


And also included these meta tags in head

Website Title


* Note that meta tags have been changed for posting this into the forum

The output is:

If you have any idea what the problem is please let me know.

Thanks for reading.
Sign In or Register to comment.