简体   繁体   English

即使用户未登录Facebook,如何显示类似按钮的Facebook?

[英]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> 当前,代码<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. 仅当我在浏览器中登录Facebook时,才显示“赞”按钮。 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. 例如,像wordpress.org一样...请参阅页面的左下角。

Thanks in advance! 提前致谢!

Best, Alex 最好,亚历克斯

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. 不会显示“喜欢”按钮(假设已正确实施)的唯一情况是,如果要被点赞的页面是对其进行了限制的Facebook页面。 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. 如果您的Facebook页面有限制,则需要登录该用户,以便可以验证该用户是否可以看到“赞”按钮。

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? 您确定要包含fb-root div和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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM