当用户点击Facebook“赞”按钮时,我如何知道?

3

我尝试实现“点赞”按钮和一些在页面点赞时触发的代码,但无法使其正常工作。

当我点赞页面时,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>

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

4

我遇到了一个错误:Event.__inlineSubmit 不是一个函数 - 即使使用这段代码。 - user1559555
测试了你的代码,它运行良好...可能错误在你的代码其他地方。 - Abhishek

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接