我尝试实现“点赞”按钮和一些在页面点赞时触发的代码,但无法使其正常工作。
当我点赞页面时,Firebug显示以下错误:
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>