Edit your link from here : it easy https://developers.facebook.com/docs/plugins/like-button/
Facebook 'LIKE' button for my fan page
-
05-07-2023 - |
Question
I have a website that I want to add a like button to my facebook "fan page" (of the website). how can I do it?
I opend a draft html page on my pc just to check that it works and I cant see nothing. I copied the basic SDK script right after the 'body' tag. and then the rest from this page.
<html>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '666',
status : true,
xfbml : true
});
};
(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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<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=458066304313544";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
Solution
OTHER TIPS
Place the code for your plugin wherever you want the plugin to appear on your page.
<div class="fb-like" data-href="https://developers.facebook.com/docs/plugins/" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>
Use the below code and change the bold line "YOUR FACEBOOK PAGE URL" to ur page url i.e., "http://facebook.com/mypage" leaving no spaces
<iframe src="//www.facebook.com/plugins/like.php?href=YOUR FACEBOOK PAGE URL&width&layout=button_count&action=like&show_faces=true&share=true&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;" allowTransparency="true"></iframe>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow