2011年10月18日 星期二

Google Plus Render +1 Button Programmatically

一般用法太簡單就不提了。

Google 建議將 script 在 body最後讀進來。
<body>
...
<div id="gplus"></div>
...
<script src="https://apis.google.com/js/plusone.js" type="text/javascript">
{lang: 'zh-TW'}
</script>
</body>


只要在某個地方觸發這段,就可以動態產生+1按鈕。
gapi.plusone.render('gplus', {'href': YOUR_LINK, 'size': 'small', 'count': false});
API參考:https://developers.google.com/+/plugins/+1button/#jsapi
+1按鈕參數參考:https://developers.google.com/+/plugins/+1button/#plusonetag-parameters

被+1的網頁會抓取得資料?
參考:https://developers.google.com/+/plugins/+1button/#plus-snippet

沒有留言:

張貼留言