2012-08-26 55 views
3

我试图实现Like按钮以及一些喜欢页面的代码,但我无法让它工作。我如何知道用户点击Facebook的按钮时?

当我喜欢的页面萤火显示了这个错误:

Event.__inlineSubmit is not a function 

,并没有任何反应(即无警报/重定向/其他)除了页面被我喜欢。到目前为止,该代码:

<div id="fb-root"></div> 

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

<div class="fb-like" data-send="false" data-layout="box_count" data-width="60" data-show-faces="false"></div> 

回答

相关问题