Reputation: 21
I'm trying to get a Facebook "Like" button to work on my webpage. I've asked for help at Godaddy.com, but they've not been able to offer much. I've added the button by using the code from Facebook and the button shows on my website. It seems to work when you click it because it says that I Like it and shows a number to the right of the button, but when I refresh the page, the Like button is there and no number to the right of the button, so it doesn't seem like it records when the button is clicked. Here is what I have:
<div id="fb-root"></div>
<script>(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'));</script>
I created two blocks on my webpage and added each of these scripts in them. Does anyone have any idea why this isn't working or what I can do so the Like button records me as Liking the website and posts how many "likes" the website has?
My website is www.mccabece.com Thank you for any help offered. Anthony
Upvotes: 1
Views: 990
Reputation: 2499
You should only add the <script>
tag once per page.
I generated the tag with the url you set, that's what I got:
<div class="fb-like" data-href="http://mccabece.com" data-send="true" data-layout="button_count" data-width="450" data-show-faces="true"></div>
Is this the code you're putting on the page?
Also, it seems that if you have no likes the number doesn't appear. What's more, as you redirect mccabece.com
to www.mccabece.com
, you might want to use http://www.mccabece.com as the url in the FB button.
Edit: without the correct url, your page will not show up on someone's FB wall when they like it.
(And the comments support the syntax @JohnDoe to address messages to a specific user)
Upvotes: 2