0

我目前正在开发 Facebook 画布应用程序,遇到了一个我似乎无法用 IE8/7 和 JS SDK 解决的问题

我正在尝试测试用户的当前状态,例如已连接,未授权。这在 Chrome、Firefox 中运行良好,但在 IE 中似乎没有触发。这是我的 Facebook JS 代码

window.fbAsyncInit = function() {
FB.init({
    appId: 'xxxxxxxxxxxx',
    channelUrl : '//www.mydomain.co.uk/channel.html', // Channel File
    cookie: true,
    xfbml: true,
    oauth: true,
    status: true
});

FB.getLoginStatus(function(response){

    if (response.status === 'connected'){
        alert('The status of the session is: ' + response.status);

        $('a#remove-app').click(function(){

        //var request = response.authResponse.accessToken;
        //console.log(request);

            $("#dialog:ui-dialog").dialog( "destroy" );

        $("#dialog-confirm").dialog({
                height:140,
                modal: true,
                position: [236,101],
                buttons: {
                    "Yes": function() {

                        if(request){
                            $.ajax({
                                type: 'get',
                                dataType: 'jsonp',
                                url: 'https://graph.facebook.com/me/permissions',
                                data: 'method=delete&access_token=' + request,
                                success: function(response) {
                                    top.location.href = 'http://facebook.com';
                                }

                            });

                        }

                    },
                    Cancel: function() {
                        $( this ).dialog( "close" );
                    }
                }
            });


            return false;
    }); 

    } else if( response.status === 'not_authorized') {

        var oauth_url = 'https://www.facebook.com/dialog/oauth/';
            oauth_url += '?client_id=xxxxxxxxx';
            oauth_url += '&redirect_uri=' + encodeURIComponent('https://apps.facebook.com/kaplan-acca-news/');
            oauth_url += '&scope=email'
        window.top.location = oauth_url;



    } else {

        //alert('user not logged in');
      var oauth_url = 'https://www.facebook.com/dialog/oauth/';
               oauth_url += '?client_id=xxxxxxxx';
               oauth_url += '&redirect_uri=' + encodeURIComponent('https://apps.facebook.com/kaplan-acca-news/');
               oauth_url += '&scope=email'
             window.top.location = oauth_url;   
    }

}, true);


$('a#invite-a-friend').click(function(){
    sendRequestViaMultiFriendSelector();
});


// Multi friend selector for Facebook
function sendRequestViaMultiFriendSelector() {

        FB.ui({method: 'apprequests',
           message: 'Come and join the app on Facebook',
        });

}

function requestCallback(response) {
    alert(response);            
}   

};
    // Load the SDK Asynchronously
    (function() {
    var e = document.createElement('script');
    e.async = true;
    e.src = '//connect.facebook.net/en_US/all.js';
    document.getElementById('fb-root').appendChild(e);
}());

有关解决此问题的任何想法,我将不胜感激。

4

1 回答 1

0

通过“JavaScript Lint”工具运行您的 JavaScript 代码。你的代码中可能有一些小的 JS 错误,Chrome / FF 会忽略,但 IE 不喜欢。

于 2012-05-31T11:12:45.430 回答