2013-03-14 85 views
1

我为我的Facebook页面标签页应用程序实现了一个简单的Facebook登录脚本。它假定向用户验证应用程序。它在所有浏览器中都可以正常工作,但IE(我有用于测试兼容性的IE10)。在IE中,它带来了身份验证弹出窗口,并且用户可以对其进行身份验证,但是与其他浏览器中的主要应用程序页面(favorite.php)不同,它不断重新加载自己(login.php)。我知道在我们的日子里没有人应该使用IE,但有些人会这样做,我甚至需要它来工作:) 谢谢!该代码是在这里:Facebook的js登录页面不断在IE10中重新加载

<body> 
<div id="fb-root"></div> 
<fb:login-button size="medium" onlogin="login()" scope="email, user_birthday">Logga in med Facebook</fb:login-button> 
<script> 
    // Additional JS functions here 
    window.fbAsyncInit = function() { 
    FB.init({ 
     appId  : 'myid', // App ID 
     channelUrl : '//www.mydomain.com/channel.html', // Channel File 
     status  : true, // check login status 
     cookie  : true, // enable cookies to allow the server to access the session 
     xfbml  : true // parse XFBML 
    }); 

    // Additional init code here 
    FB.getLoginStatus(function(response) { 
    if (response.status === 'connected') { 
     // connected 

    } else if (response.status === 'not_authorized') { 
     // not_authorized 
     //login(); 
    } else { 
     // not_logged_in 
     //login(); 
    } 
    }); 

    }; 

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

    function login() { 
    FB.login(function(response) { 
     if (response.authResponse) { 
      // connected 
      window.location = 'liked.php'; 
     } else { 
      // cancelled 
     } 
    }); 
} 
</script> 
</body> 

回答

相关问题