-1

I try to show like box on my website, but it wont work. I copy the code from https://developers.facebook.com/docs/plugins/like-box-for-pages, tried html5 version but i see nothing.

Here is my code:

<!DOCTYPE html>
<html lang="de">
  <head>
    <meta charset="utf-8">
    <title>Gamers Solution</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/de_DE/sdk.js#xfbml=1&version=v2.0";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>
        <div class="fb-like-box" data-href="https://www.facebook.com/FacebookDevelopers" data-colorscheme="light" data-show-faces="true" data-header="true" data-stream="false" data-show-border="true"></div>
  </body>
</html>
Timothy Groote
  • 8,614
  • 26
  • 52
Dominik
  • 299
  • 6
  • 18

2 Answers2

1

Looks like you're missing a little bit in the URL that points to the sdk.js file:

      js.src = "//connect.facebook.net/de_DE/sdk.js#xfbml=1&version=v2.0";
      //this equates to file://connect.facebook.net/de_DE/sdk.js#xfbml=1&version=v2.0
      //and will probably not point to the file you're looking for, even if you
      //intended to load the resource from a local source.

Should be:

      js.src = "http://connect.facebook.net/de_DE/sdk.js#xfbml=1&version=v2.0";
      //or if you're using https
      js.src = "https://connect.facebook.net/de_DE/sdk.js#xfbml=1&version=v2.0";
Timothy Groote
  • 8,614
  • 26
  • 52
0

If you ran this on a "live website" it would work. But since you are running it locally, it automatically appends "file:" instead of "http:".