[英]How to create the share button?
我正在創建一個社交網站,顯示來自用戶朋友的狀態供稿。 我想添加一個按鈕,當人們單擊該按鈕時,他們可以將狀態共享給自己的狀態供稿,而他們的朋友可以看到共享的項目。 如何實現呢? 如何設置數據庫和查詢?
謝謝
要創建具有共享按鈕的Facebook頁面,您可以使用
href = "http://www.facebook.com/sharer.php?u=<url to be shared>"
您可以參考Facebook Social插件的官方文檔
要創建Google+共享按鈕,只需添加以下內容(摘自Google Developers Documentation)
<!-- Place this tag where you want the share button to render. -->
<div class="g-plus" data-action="share"></div>
<!-- Place this tag after the last share tag. -->
<script type="text/javascript">
(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>
注意:這兩個都可以直接放在您網站的html
頁面上。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.