Facebook edge.create event not firing on like box

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

And my jsFiddle here to demonstrate: http://jsfiddle.net/dmcs/3D2GD/1/

EDIT

I've found the solution!

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.

Then for the app setting I specified I went in and specified the WebSite url on https://developers.facebook.com/apps/{APP_ID}/summary

Here's my code

<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>

just need to replace code:

<div class="fb-like-box" data-href="http://www.facebook.com/jsfiddle" 
data-width="292" data-show-faces="true" data-stream="false" data-header="true">

with this one :

<fb:like-box href="http://www.facebook.com/jsfiddle" 
colorscheme="light" show_faces="false" header="false" stream="false" 
show_border="false"></fb:like-box>

and it works ok.

链接地址: http://www.djcxy.com/p/53378.html

上一篇: “喜欢盒子”的Facebook活动

下一篇: Facebook的edge.create事件没有像框中射击