Facebook like box not showing in HTML page

I am trying to insert facebook like box in html page and i am following this guide: Facebook like box

I am inserting the JavaScript SDK code after the ‘body’ tag and then inserting the code for the plugin but when i load the page the facebook like box does not appear. Any idea what might be the reason the like box to not show?

Can you show the page?

Hi there emil5768,

it will not work locally. :ng:

To see the “like button” in all it’s glory, you must
upload the containing document to your site. :ok:

Alternatively, you can install a program like…
XAMPP or EasyPHP as a test server. :sunglasses:

coothead

This is how i am entering the code in the page:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>CNN</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

  </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_US/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/cnn" data-width="300" data-height="200" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true" data-show-posts="false"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/cnn"><a href="https://www.facebook.com/cnn">CNN</a></blockquote></div></div>


  </body>
</html>

But it doesn’t work. I also uploaded the page to a server but it didn’t work also.

I uploaded the script once again and this time it worked, i don’t know why it didn’t worked before. It did gave me parse error in the first line of the html page code though, so i had to delete it but i don’t know how the first line may be causing this kind of problems.

You should move the script to just before the </body> tag.

Where you have it above the tag it refers to it may try to run before that tag loads and therefore not find it.

With the arrangement you currently have I would not expect it to work.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.