Reputation: 29507
I've been trying to implement a Facebook Like button on my blog like this:
$("#fblike").append(" <iframe src='http://www.facebook.com/plugins/like.php?app_id=217624258276389&" + window.location.href + "&send=false&layout=box_count&width=50&show_faces=false&action=like&colorscheme=light&font&height=60' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:50px; height:60px;' allowTransparency='true'></iframe>");
And adding this to the <head>
of my HTML source file:
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
The problem is that when I try to test the Like button it shows 1 instead of 0 and a second later goes back to 0. Nothing changed at my Facebook profile neither. What's wrong and how to correct this?
PS: I'm running this on a localhost server, in my case http://nathan-camposs-macbook-pro.local/~Nathan
Upvotes: 6
Views: 1375
Reputation: 22369
I think the events go something like:
UPDATE:-
I noticed that your src attribute starts: 'http://www.facebook.com/plugins/like.php?app_id=217624258276389&" + window.location.href + "&
i think it should be: 'http://www.facebook.com/plugins/like.php?app_id=217624258276389&href=" + window.location.href + "&
notice the href=
Upvotes: 1
Reputation: 1081
If you use fbml then you will not need the application ID. Using fbml you can configure several things. I think you already have a look at-
http://developers.facebook.com/docs/reference/plugins/like/
You can try the following code
<head>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
</head>
Then in the body
<div id="fb-root"></div>
<fb:like href="http://yoururl" send="true" width="450" show_faces="true" font="">
</fb:like>
Upvotes: 0
Reputation: 1475
I've had problems testing the like on sites using temp urls - Facebook doesn't like it when the associated app_id value is not related to the url of the page you're trying to like. But I could be wrong. If you temporarily expand the width to something beyond 50 (like 300-350), there should be an "error" link that pops up that will give you some more valuable information...
Upvotes: 0