facebook分享(含圖片),
一、查看當前URL下facebook資訊情況Open Graph Object Debugger<輸入URL,查看當前URL是否具有facebook資訊>:
https://developers.facebook.com/tools/debug/og/object/
Show existing scrape information:查看已配置的facebook資訊
Fetch new scrape information:設定新的facebook資訊
二、設定對應facebook資訊1. 所有資訊必須在對應URL下的頁面進行添加,如www.baidu.com,必須在baidu的首頁下進行添加
2. Facebook共用清單,參照下述URL
https://developers.facebook.com/docs/plugins/checklist
三、執行個體如:在http://tztest4.ptmind.cn/test.htm下,添加facebook分享代碼。
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>facebook share test</title><meta property="og:site_name" content="site name"/><meta property="og:title" content="title"/><meta property="og:type" content="website"/><meta property="og:description" content="description"/><meta property="og:image" content="http://www.ptengine.jp/images/hatenablog.png"/><meta property="og:url" content="http://tztest4.ptmind.cn/test.htm"></head><body><script>function fbs_click(){window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent('http://tztest4.ptmind.cn/test.htm'),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><a onclick="return fbs_click()" target="_blank"><img src="ADD_IMAGE_URL_HERE" alt="Share on Facebook" /></a></body></html>
Window.open()請參考:http://www.w3cschool.cc/jsref/met-win-open.html
facebook開發API:https://developers.facebook.com/docs/plugins/embedded-posts
分享按鈕:https://developers.facebook.com/docs/plugins/share-button/
參考文獻:http://blog.sina.com.cn/s/blog_6cd33db60100sd9j.html