htmlfacebookfacebook-javascript-sdkfbml

Facebook Like Button popup dialog closing immediately after clicking


I am simply trying to test a bit of like functionality on a test page and am getting unexpected behavior. When I click the like button the dialog(the one where you can add text and post to your wall) pops up for about half a second before closing by itself. The like button itself turns into a link that says "confirm". I really have the bare bones here and am not sure what could be going wrong. I'm using FBML. Here is the complete code for my test page:

<!DOCTYPE html>
<html>
  <head>
    <title>Facebook Like Test</title>
  </head>

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

    <script>
         window.fbAsyncInit = function () {
            FB.init({
                appId: 'myid',
                status: true, // check login status
                cookie: true, // enable cookies to allow the server to access the session
                xfbml: true  // parse XFBML
            });
        };

        // Load the SDK Asynchronously
        (function (d) {
            var js, id = 'facebook-jssdk'; if (d.getElementById(id)) { return; }
            js = d.createElement('script'); js.id = id; js.async = true;
            js.src = "//connect.facebook.net/en_US/all.js";
            d.getElementsByTagName('head')[0].appendChild(js);
        } (document));

    </script>

    <h1>Facebook Like Testing</h1>
    <div>
        <fb:like href = "http://www.example.com?id=1"></fb:like>
    </div>
    <div>
        <fb:like href = "http://www.example.com?id=2"></fb:like>
    </div>
    <div>
        <fb:like href = "http://www.example.com?id=3"></fb:like>
    </div>
    <div>
        <fb:like href = "http://www.example.com?id=4"></fb:like>
    </div>  
  </body>
</html>

I simply appended an arbitrary as a query string to make the hrefs unique. What could be going wrong here?


Solution

  • Alright I'm going to answer my own question because I found out the issue and would like the answer to be there for anyone else who gets this error.

    As it turns out the problem was not with my code but with the href I was specifying. I found the answer here . It has to do with the site I was implementing this on not being known well enough or flagged as "suspicious".