2013-03-14 2 views
1

내 Facebook 페이지 탭 앱용 간단한 페이스 북 로그인 스크립트를 구현했습니다. 사용자에게 앱을 인증한다고 가정합니다. 모든 브라우저에서 정상적으로 작동하지만 IE (호환성 테스트 용 IE10이 있습니다). IE에서는 의도 한대로 인증 팝업을 표시하고 사용자는 인증 할 수 있지만 다른 브라우저에서와 마찬가지로 기본 앱 페이지 (liked.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> 

답변

관련 문제