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>
我得到一个错误:事件.__ inlineSubmit不是一个功能 - 即使使用此代码 – user1559555
测试你的代码,它工作正常...可能是你的代码中的其他地方有错误。 – Abhishek
小提琴工作正常。 – Abhishek