简体   繁体   English

如何在JSFiddle上获取Facebook Like按钮?

[英]How to get Facebook Like button on JSFiddle?

So I want to put a Facebook like button on my website. 所以我想在我的网站上放置一个类似Facebook的按钮。 I have used the code from the Facebook page but the button doesn't appear. 我已经使用了Facebook页面上的代码,但是没有出现该按钮。 Any help? 有什么帮助吗?

http://jsfiddle.net/genome314/204de8ry/ http://jsfiddle.net/genome314/204de8ry/

HTML HTML

<div id="fb-root"></div>
<div class="fb-like" data-href="https://developers.facebook.com/docs/plugins/" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>

JavaScript 的JavaScript

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

This is where I got the code from https://developers.facebook.com/docs/plugins/like-button 这是我从https://developers.facebook.com/docs/plugins/like-button获得代码的地方

I have no idea what could be wrong with the HTML5 like button, but the least I can say is that the iframe button works on jsfiddle: 不知道 HTML5类按钮可能有什么问题,但我至少可以说iframe按钮可在jsfiddle上使用:

<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fplugins%2F&amp;width&amp;layout=standard&amp;action=like&amp;show_faces=true&amp;share=true&amp;height=80&amp;appId=YOUR_APP_ID" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:80px;" allowTransparency="true"></iframe>

JSFiddle 的jsfiddle

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

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