fb like button code not working

Myra Fletcher picture Myra Fletcher · Dec 19, 2012 · Viewed 9.6k times · Source

I have tried all of the options for inserting code to get a facebook like button on a clients website and it doesnt show up, can anyone help me with a simple code that will make the button work, the link to like is nnacanada

Answer

cesarfaria picture cesarfaria · Dec 19, 2012

First you have to create a app to get an app ID

https://developers.facebook.com/apps

Second you have to generate the code for your like button here: https://developers.facebook.com/docs/reference/plugins/like/ OR use the following code:

You need to put your html tag like that:

<html lang="pt" xmlns:fb="http://www.facebook.com/2008/fbml">

And between <body> and </body> you need to put the following code

<fb:like href="http://www.your.page.url" layout="standard" show-faces="true" send="true" width="450" action="like" colorscheme="light"></fb:like>



<!-- Facebook -->
<div id="fb-root"></div>
<script type="text/javascript">
    window.fbAsyncInit = function() {
        FB.init({appId: 'your-facebook-app-id', status: true, cookie: true, xfbml: true});
    };
    (function() {
        var e = document.createElement('script');
        e.type = 'text/javascript';
        e.src = document.location.protocol + '//connect.facebook.net/pt_PT/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
    }());
</script>

don't forget to replace "http://www.your.page.url" and "your-facebook-app-id" with correct values.