2013-07-18 34 views
0

出現我使用Facebook的從文檔中的登錄代碼:Facebook的權限窗口不會在平板電腦上使用JS SDK

這個工作在桌面瀏覽器,但在平板電腦上的整個網站試圖重定向到一個https://m.facebook.com...網址,而不是罰款顯示權限彈出。它重定向到的頁面只顯示錯誤。可以彈出窗口不能在Facebook Javascript SDK中工作?

<div id="fb-root"></div> 
<script type="text/javascript"> 

    var likesPage = false; 
    var addisPageId = 'XXXXXX'; 


    window.fbAsyncInit = function() { 
     // init the FB JS SDK 
     FB.init({ 
      appId: 'XXXXXXX',      // App ID from the app dashboard 
      channelUrl: '/channel.html', // Channel file for x-domain comms 
      status: true,         // Check Facebook Login status 
      xfbml: true         // Look for social plugins on the page 
     }); 

     // Additional initialization code such as adding Event Listeners goes here 
    }; 

    // Load the SDK asynchronously 
    (function (d, s, id) { 
     var js, fjs = d.getElementsByTagName(s)[0]; 
     if (d.getElementById(id)) { return; } 
     js = d.createElement(s); js.id = id; 
     js.src = "//connect.facebook.net/en_gb/all.js"; 
     fjs.parentNode.insertBefore(js, fjs); 
    } (document, 'script', 'facebook-jssdk')); 
    function callLogin() { 
     FB.login(function (response) { 
      var access_token = FB.getAuthResponse()['accessToken']; 
      $("#at").val(access_token); 

      if (response.authResponse) { 
       FB.api('/me/likes?fields=id', function (response) { 

        for (var i = 0; i < response.data.length; i++) { 
         if (response.data[i].id == addisPageId) { 
          likesPage = true; 
          break; 
         } 
        } 
        if (likesPage) { 
         FB.api('/me', function (userInfo) { 
          document.getElementById("email").value = userInfo.email; 
          document.getElementById("fbId").value = userInfo.id; 
          document.getElementById("fbform").submit(); 
         }); 
        } else { 
         document.getElementById("dontLikePage").style.display = "inline"; 
        } 
       }); 
      } else { 
       window.parent.location = "https://www.facebook.com/XXXX"; 
      } 
     }, { scope: 'user_likes,email,publish_stream' }); 

    } 
</script> 

回答

相關問題