0
即時通訊嘗試實現帶回調的Facebook分享功能。帶回調的FB分享
我發現這個示例腳本
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" ></script>
<script>
function fb_share() {
FB.ui({
method: 'feed',
name: "Facebook API: Tracking Shares using the JavaScript SDK",
link: "https://www.webniraj.com/2013/05/11/facebook-api-tracking-shares-using-the-javascript-sdk/",
picture: "https://stackexchange.com/users/flair/557969.png",
caption: "Tracking Facebook Shares on your website or application is a useful way of seeing how popular your articles are with your readers. In order to tracking Shares, you must used the Facebook JavaScript SDK."
}, function(response) {
if (response !== null && typeof response.post_id !== 'undefined') {
console.log(response);
// ajax call to save response
$.post('http://www.example.com/', { 'meta': response }, function(result) {
console.log(result);
}, 'json');
}
});
}
$(document).ready(function(){
$('.share-btn').on('click', fb_share);
});
</script>
</head>
<body>
<button class='share-btn'>click</button>
</body>
</html>
但它似乎沒有工作,雖然有些人說,這爲他們工作。當我點擊按鈕什麼都沒有發生。某處有錯誤嗎?或者,也許有人可以指示我去另一個樣本。將非常感謝!乾杯。
嘿,非常感謝!它現在確實有效,但有一個小小的問題。只有我可以使用共享功能...其他出錯說:出現錯誤。我檢查了Facebook設置中的網址,一切似乎都沒有問題。爲什麼只有我可以使用共享功能? – zet
對不起,我愚蠢...該應用程序沒有公開。再次感謝! – zet
太棒了!如果我滿意地回答了您的問題,那麼您可以檢查一下:http://stackoverflow.com/help/someone-answers :) – Boomish