Reputation: 32344
I'm building a site and I hope to be able to "like" it using Facebook. I've glanced over their SDK, and it seemed pretty straight forward...
I've "made" this:
<html>
<head>
</head>
<body>
<h1>Testing the Facebook like button</h1>
<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_GB/all.js#xfbml=1&appId=177127339057410";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-href="http://yannbane.blogspot.com/" data-send="false" data-width="450" data-show-faces="true"></div>
</body>
</html>
And I saved it as "index.html" on my computer. Now, when I try to open it, it just displays "Testing the Facebook like button" header and continues on loading, and nothing really happens. How come? I'm of course not trying to "like" index.html, but my blog (http://yannbane.blogspot.com/), so I thought there should be no problems with opening it locally...
Upvotes: 0
Views: 3555
Reputation: 4688
In your head you need to have the opengraph information, facebook requires it for the like button to appear.
the meta tags should look like this
meta property="og:tag name" content="tag value"
Information required is
-og:title
-og:type
-og:image
-og:url
-og:site_name
-fb:admins
you can read more here https://developers.facebook.com/docs/reference/plugins/like/
Upvotes: 5