如何在有人按下新Facebook訂閱按鈕時觸發活動? 我可以用「Like」按鈕,使用上面的代碼做到這一點,所以我認爲它將與Subscribe按鈕類似。在Facebook的「訂閱」按鈕上處理點擊
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: 'App_ID', status: true, cookie: true, xfbml: true});
FB.Event.subscribe('edge.create', function(href, widget) {
alert('You just clicked the like button');
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
'edge.create'在用戶喜歡頁面時觸發事件,因此我可以得到響應,並向用戶顯示警報。我搜索了一段時間,並找不到與「訂閱」按鈕類似的方式。
有沒有人這樣做?
嗨迭戈,這是你在找什麼:[fb docs for callback with subscribe](http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/) – Jonah