我有一個網站,並且我有一個名爲share的facebook按鈕。我希望當用戶點擊該按鈕時,我的網頁內容應該分享到他的牆上。我的代碼是這樣的頁面我的頭標記:如何在Facebook上共享我網站的內容
<script>
function fbs_click(){
u = location.href;
t = document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
return false;
}
</script>
我也知道,你的內容頁t= title
或站點名稱的u= url
,這是身體標記內:
<a rel="nofollow" href="http://www.facebook.com/share.php?u=http://lums.edu.pk/event-detail/lecture-on-citation-management-and-referencing-1133"
class="fb_share_button" onclick="return fbs_click()" target="_blank"
style="text-decoration:none;">Share</a>
u是我想分享的鏈接。 這段代碼爲我打開了一個共享頁面,只分享我的網址,而不是我的網頁內容。我的內容包括圖像,標題和細節(我從數據庫表中獲取這些值)。請有人幫助我。
我不跟OpenGraph tags.Will使用你一點解釋更多嗎?我讀過[鏈接](http://huebris.com/facebook-share-button/)此頁 – user1885057
在這裏閱讀更多:http://ogp.me/ –