开发者

Facebook permissions in IE Causing infinite facebook loop

I am trying to get permissions for a facebook app I am making, but every time I try to run the app in IE8 I cannot get the permissions box to show up. I have tested the app in firefox and it can open fine, and get all the permissions fine (i dont ask for any special ones).

When I run the debugger in IE8 I see that once the program hits FB.getLoginStatus(function (response) { (see code below) it then moves into an infinite loop of code written by facebook.

I think the issue is because of how I am making the permissions call. I have a form that I use for a login that will call the permissions method once the user attempts to login to the site. Here is the form and button in the form I use:

<form id = "membershipInfo" method = "post" action = "Login.aspx">
<input type = "button" id = "submitInfo" class = "MemberInfo" value = "Take Me There!" onclick = "authorize(acceptPermissions, rejectPermissions)"/>

And here is the auth method I use:

function authorize(successCallback, failureCallback) {
FB.getLoginStatus(function (response) {
   //****** DOES NOT MAKE IT PAST HERE *******//
    if (response.session) {
        // logged in and connected user, carry on
        session = response.session;
        //Set access token
        accessToken = response.session.access_token;
        //Call success callback
        successCallback();
    } else {
        // no user session available, Lets ask for perms
        FB.ui(
        {
            method: 'permissions.request',
            perms: permissionString //(equals "" )
        },
        function (response) {
            if (response && response.session != null) {
                //Get session
                session = response.session;
                //Set access token
                accessToken = response.session.access_token;
                //Call success callback
                successCallback();
            } 开发者_如何学运维else {
                //Call failure callback
                failureCallback();
            }
        });
    }
});

When the user accepts permissions they get moved into a success callback method which is here (never makes it this far):

function acceptPermissions() {
    //Code done before moving on
    $('#submitInfo').submit();
}

Anyone see any issues?


That looks like it should work to me, so probably a good opportunity to file a bug report with Facebook....

That said, I think you could clean up your code using FB.login instead http://developers.facebook.com/docs/reference/javascript/FB.login/

FB.login(function(response){
    if(response.session){
        // logged in and connected user, carry on
        session = response.session;
        //Set access token
        accessToken = response.session.access_token;
        //Call success callback
        successCallback();
    }
    else{
        failureCallback();
    }
}, {perms: permissionString});


So here's a question: do you have Flash installed? IE8, being the way it is, may be trying to load the Flash-based XD, and then failing silently. If you install Flash (and/or put in a catch for that), does it work?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜