Share Button
https://developers.facebook.com/docs/plugins/share-button
JavaScript的SDK初始化
<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.5";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
將你的插件代碼,無論你想要的插件出現在頁面上。
<div class="fb-share-button" data-href="單一頁面" data-layout="button_count"></div>
FB給的語法是"單一頁面"的語法, 要安裝的事"動態頁面"的語法
<div class="fbBox">
<a href="#" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href), 'facebook-share-dialog', 'width=626,height=436'); return false;" class="fbShare">分享至facebook</a>
<div class="fb-like fbLike" data-href="https://www.facebook.com/bigcamera/" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false"></div>
</div>
參考範例:
http://wallywarp.com/goods.php?act=view&no=296
http://www.prime.com.tw/goods.php?act=view&no=126
http://www.gassho.com.tw/tw/news.php?act=view&no=33