【JavaScript】Facebook按讚與分享

Include the JavaScript SDK on your page once, ideally right after the opening <body> 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/zh_TW/sdk.js#xfbml=1&version=v2.8";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

 

將此程式碼放置在你希望外掛程式顯示的頁面位置。
<div class="fb-like" data-href="http://www.facebook.com/iisigroup" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>