Facebook edge.create事件未在类似框上触发 [英] Facebook edge.create event not firing on like box
问题描述
我的页面上有一个简单的Facebook like按钮,我需要知道用户何时喜欢该页面,因此我使用edge.create事件来完成此操作,一切正常.现在,我需要在页面上添加一个赞"框插件,以赞美客户端的Facebook页面,并且当有人单击赞"按钮时,也需要通知我.但是,订阅事件永远不会触发.知道可能是什么问题吗?我正在使用xfbml代码添加喜欢"框.
I had a page with a simple Facebook like button and I needed to know when the user liked the page so I used the edge.create event to do this which all worked fine. I now need to add a like Box plugin to the page to like the client's facebook page and again I need to be notified when someone clicks the like button. However, the subscribe event never fires. Any idea what might be the problem? I am using the xfbml code to add the like box.
推荐答案
它似乎是一个错误.这是官方可靠来源的链接:
It appears to be a bug. Here's a link to official credible sources:
http://developers.facebook.com/bugs/310763168934515
我的jsFiddle在这里演示: http://jsfiddle.net/dmcs/3D2GD/1/
And my jsFiddle here to demonstrate: http://jsfiddle.net/dmcs/3D2GD/1/
编辑
我找到了解决方案!
首先,我将代码放到自己的域中,而不是jsFiddle上,以进行更好的测试,但是我的第一次尝试失败了,就好像代码仍在jsFiddle上一样.所以我进一步困扰了这种情况.
First I put my code onto my own domain rather than jsFiddle to do better testing, however my first try failed as if the code was still on jsFiddle. So I troubleshot the situation further.
然后针对我指定的应用设置,我进入并在https://developers.facebook.com/apps/{APP_ID}/summary
Then for the app setting I specified I went in and specified the WebSite
url on https://developers.facebook.com/apps/{APP_ID}/summary
这是我的代码
<html>
<head>
<title>Like Box example</title>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: '{APP_ID}'
});
FB.Event.subscribe('edge.create', function(response) {
alert('You liked the URL: ' + response);
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id; //js.async = true;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId={APP_ID}";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-like-box" data-href="http://www.facebook.com/Cocacola" data-width="292" data-show-faces="true" data-stream="true" data-header="true"></div>
</body>
</html>
这篇关于Facebook edge.create事件未在类似框上触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!