Receiving notifications for the Facebook Like button on my website

[亡魂溺海] 提交于 2019-12-11 23:59:58

问题


I'm trying to receive Facebook notifications (within Facebook) when a user Likes a post on my blog - http://visualise.ca.

I have the following code, the plugin works fine but I can't get notifications and I don't know what I'm doing wrong. Here is a sample of the code:

<html lang="en">
<head>
<meta charset=utf-8>
<meta property="fb:admins" content="589865326" />
</head>
<body>

<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=134951483245924&amp;xfbml=1"></script><fb:like notify="true" href="http://visualise.ca" send="true" layout="button_count" width="450" show_faces="false" colorscheme="dark" font=""></fb:like>

<script type="text/javascript">
window.fbAsyncInit = function() {
    FB.init({appId: '134951483245924', status: true, cookie: true, xfbml: true});
    FB.Event.subscribe('edge.create', function(href, widget) {
    // Do something, e.g. track the click on the "Like" button here
    });
};
(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>
</body>
</html>

What am I missing? Many thanks for your time and help.


回答1:


FB.Event.subscribe('edge.create', function(href, widget) {
    // Do something, e.g. track the click on the "Like" button here
});

To get "notifications" (not Facebook notifications as they don't exist for the like button), this is where you can AJAX back to your server that someone liked the page.



来源:https://stackoverflow.com/questions/9254388/receiving-notifications-for-the-facebook-like-button-on-my-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!