Fabman
Fabman

Reputation: 372

Unable to make the facebook “like” button to work on this site, any ideas?

This is the site >> ( removed ) the site has been redone since this question has been post, so it was useless.

I'm using a plugin and also trying to use the usual facebook like button that it's explained here: https://developers.facebook.com/docs/reference/plugins/like/

Anyhow, the like button simply doesn't work or appears to have a # url.

I looked in StackExchange for any similar question, but all the problems seems to be different, any idea or link to an answer will be highly appreciated.

EXAMPLE CODE:

There's no much code to show really, just the one that facebook gives you on their site, like this:

This goes right after the tag:

<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_GB/all.js#xfbml=1";
   fjs.parentNode.insertBefore(js, fjs);
 }(document, 'script', 'facebook-jssdk'));</script>

and this in the position I want the button to appear:

<div class="fb-like" data-href="http://www.elsolitario.com/" data-send="false" data-layout="button_count" data-width="450" data-show-faces="true"></div>

it should be that simple, but it seems that won't work no matter what.

Upvotes: 0

Views: 1299

Answers (1)

Darvex
Darvex

Reputation: 3654

It appears that you forgot to add appId parameter in

js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1

it should be

js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=YOUR_APP_ID

Here's some code i'm using... Header:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
 <script src="http://connect.facebook.net/en_US/all.js"></script>

Right after header:

<div id="fb-root"></div>
<script>
  FB.init({
    appId  : 'YOUR_APP_ID',
    status : true, // check login status
    cookie : true, // enable cookies to allow the server to access the session
    xfbml  : true, // parse XFBML
    oauth  : true // enable OAuth 2.0
  });
</script>

And the button wherever you need it:

<fb:like href="YOUR_LINK" show_faces='false' layout="button_count" stream='false' header='false'></fb:like>

Upvotes: 1

Related Questions