Alex
Alex

Reputation: 329

How to show facebook like button even if user isn't logged into Facebook?

Currently, the code <div class="fb-like" data-href="https://facebook.com/myappurl" data-send="false" data-width="450" data-show-faces="false"></div>

Only shows the like button if I am logged into Facebook in the browser. How do I get it to display even if the user is logged out?

Like wordpress.org for example...See the bottom left hand corner of the page.

Thanks in advance!

Best, Alex

Upvotes: 0

Views: 1660

Answers (2)

Fisch
Fisch

Reputation: 3815

The only situation where a like button will not show up (assuming it has been implemented properly) is if the page that is to be liked is a Facebook page that has a restriction placed on it. This includes country and age restrictions. If your Facebook page has a restriction, the user needs to be logged in to Facebook so that the user can be verified as to be allowed to see the like button.

Upvotes: 3

Nick R
Nick R

Reputation: 7784

It displays regardless of whether a user is logged in or not. If the user is not logged in and clicks on Like, they get a popup that says

"You must log in to see this page."

Are you sure you're including the fb-root div and the Javascript?

<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&appId=Your-App-ID-HERE";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Upvotes: 0

Related Questions