Search code examples
javascriptfacebookfacebook-likefacebook-likebox

Facebook Like Box does not redirect users to Facebook pages as Facebook Like button does


Like Button: (successfully direct uesrs to specific Facebook pages) Example: [http://lifelearning.x10.mx/FB-test2.html][1]

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head></head>
<body>
<div id="fb-root"></div>

<fb:like href="http://www.facebook.com/pages/AEA-%E6%BE%B3%E6%B4%B2%E6%95%99%E8%82%B2%E5%8D%94%E6%9C%83/372744124562?bookmark_t=page" send="false" width="450" show_faces="false" font=""></fb:like>

<script type="text/javascript">
    window.fbAsyncInit = function() {
        FB.init({appId: '372744124562', status: true, cookie: true, xfbml: true});
        FB.Canvas.setSize({ width: 520, height: 1500 });
        FB.Event.subscribe('edge.create',
            function(response) {
                // put redirect code here eg
                window.location = "http://www.facebook.com/pages/AEA-%E6%BE%B3%E6%B4%B2%E6%95%99%E8%82%B2%E5%8D%94%E6%9C%83/372744124562?bookmark_t=page"; 
            }
        );
    };

    //Load the SDK asynchronously
    (function() {
        var e = document.createElement('script'); e.async = true;
            e.src = document.location.protocol +
              '//connect.facebook.net/en_US/all.js';
            document.getElementById('fb-root').appendChild(e);
    }());
</script>
</body>
</html>

Like Box: (unsuccessful) Example: [http://lifelearning.x10.mx/FB-test3.html][2]

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head></head>
<body>
<div id="fb-root"></div>

<fb:like-box href="http://www.facebook.com/pages/AEA-%E6%BE%B3%E6%B4%B2%E6%95%99%E8%82%B2%E5%8D%94%E6%9C%83/372744124562?bookmark_t=page" width="292" show_faces="true" stream="true" header="true"></fb:like-box>


<script type="text/javascript">
    window.fbAsyncInit = function() {
        FB.init({appId: '372744124562', status: true, cookie: true, xfbml: true});
        FB.Canvas.setSize({ width: 520, height: 1500 });
        FB.Event.subscribe('edge.create',
            function(response) {
                // put redirect code here eg
                window.location = "http://www.facebook.com/pages/AEA-%E6%BE%B3%E6%B4%B2%E6%95%99%E8%82%B2%E5%8D%94%E6%9C%83/372744124562?bookmark_t=page"; 
            }
        );


 };

    //Load the SDK asynchronously
    (function() {
        var e = document.createElement('script'); e.async = true;
            e.src = document.location.protocol +
              '//connect.facebook.net/en_US/all.js';
            document.getElementById('fb-root').appendChild(e);
    }());
</script>
</body>
</html>

People say this is a bug on Like Box. Some people demonstrate it does work: http://www.fbrell.com/xfbml/fb%3alike-box

Could anyone who knows well about Facebook please help? I know JS a lot but just know nothing about the API of Facebook. Can anyone tell how to make Like Box work in the same way as Like Button does.

* These are all collected from the web. And the codes are mine.


Solution

  • The issue is that the edge.create event is not fired by the Like Box, so you will not be able to get that to work. I suggest you add your voice to the following bug report about this problem:

    https://developers.facebook.com/bugs/310763168934515