接收我网站上的"Facebook点赞"按钮的通知 [英] Receiving notifications for the Facebook Like button on my website
问题描述
当用户喜欢我的博客上的帖子- http://visualise时,我正在尝试接收Facebook通知(在Facebook内). ca .
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&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.
推荐答案
FB.Event.subscribe('edge.create', function(href, widget) {
// Do something, e.g. track the click on the "Like" button here
});
要获取通知"(不是Facebook通知,因为"like"按钮不存在这些通知),您可以在此处将AJAX返回您喜欢该页面的服务器.
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.
这篇关于接收我网站上的"Facebook点赞"按钮的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!