开发者

Why does fb:fan control disappear after login with requireSession on external page?

Reqs:

  • I want to make an external page with a 'Become a Fan'-button.
  • I want users to login to facebook once they open the page (this is because of other features in the site)

So I call FB.Connect.requireSession once the page loads, and put a <fb:fan></fb:fan> control on the page.

Then when I open the page I see the 'Connect with Facebook to Continue' pop-up and a small 'Become a fan' button. This seems right. When I log in to Facebook using the pop-up the 'Become a fan button' disappears!!

Can anyone explain this weird behaviour or does someone know a way to reach my requirements in a different way.

Below you can see my code.

Thanks in advance!

    <!-- Head -->
    <s开发者_运维问答cript src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/nl_NL" type="text/javascript"></script>
    <script type="text/javascript">

        var fbApiKey = "MY_KEY";
        var fbXdReceiver = "xd_receiver.htm";

        function fbLoad() {
            FB.init(fbApiKey, fbXdReceiver);

            FB.ensureInit(function() {
                FB.Connect.requireSession(null, null, false);
            });
        }

    </script>


    <!-- Body onload="fbLoad();" -->
    <fb:fan profile_id="24932281961" name="Nutella" id="fanButton" stream="0" connections="0" logobar="0" width="250"></fb:fan>


I solved this by making the page refresh after a successful login

So I call requireSession with a callback

FB.ensureInit(function() {
   FB.Connect.requireSession(requireSessionSuccess, null, false);
});

And this is the code for the callback

function requireSessionSuccess() {
   window.open('default.aspx?fbloggedin=true', '_self');
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜