我使用以下代码获取 Facebook 分享按钮、Facebook 赞、Facebook 发送和 Google +1:
<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/ar_AR/all.js#xfbml=1&appId=<?php echo Configure::read('FBappId');?>";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<!-- FaceBook SHARE BUTTON HERE -->
<a name="fb_share"></a>
<!-- End FACEBOOK SHARE -->
<div class="fb-send" data-href="<?php echo $URL;?>" data-font="tahoma"></div>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"
type="text/javascript">
</script>
<div class="fb-like" data-send="false" data-layout="button_count" data-width="" data-show-faces="false" data-font="tahoma"></div>
<span>
<!-- Place this tag where you want the +1 button to render -->
<g:plusone size="medium"></g:plusone>
<!-- Place this render call where appropriate -->
<script type="text/javascript">
window.___gcfg = {lang: 'ar'};
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
</span>
问题是Facebook 分享按钮在宽度和高度为 1000 像素的 iframe 中呈现,并且呈现超出预期的视图范围。下面的屏幕截图会解释得更清楚: 顺便说一句:文档是 RTL 方向,分享按钮应该放在其他按钮旁边。屏幕截图是使用 FireFox 18.0 拍摄的。