2013-03-14 81 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> 

回答

相關問題