htmlfacebookfacebook-like

Facebook Like Box is not Working


I have been trying to implement FB like box to my website, but unsuccessfully. I can not show the box at all. I followed the instructions and added both parts of code as is described here: https://developers.facebook.com/docs/plugins/page-plugin

Here is the code:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Fan Page</title>
    </head>

    <body>
        <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_EN/sdk.js#xfbml=1&version=v2.5";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>

        <div class="fb-page" 
        data-href="https://www.facebook.com/facebook" 
        data-width="340" data-height="390" 
        data-small-header="false" 
        data-adapt-container-width="true" 
        data-hide-cover="false" 
        data-show-facepile="true" 
        data-show-posts="true">
        <div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/facebook"><a href="https://www.facebook.com/facebook">Facebook</a></blockquote></div></div>
    </body>
</html>

I just copied it from their website and pasted to my one.

As a result I do not get the like box, but only clickable Facebook text. That is all, no box.

Please, what am I doing wrong? I will be very grateful for any help.

***** EDITED: *****

enter image description here


Solution

  • It's not a Facebook issue. You are trying to access Facebook's JS SDK from your local machine. Obviously the browser can't find it there :)

    Browser looking for JS SDK on local machine

    Running the script on a server (either webhost or your localhost) and it runs fine.