2013-06-26 207 views
0

即時通訊我的頭髮試圖解決這個問題。我喜歡的頁面使用facebook js sdk示例中使用的確切代碼來查看用戶是否喜歡該頁面。這適用於所有桌面瀏覽器,但不適用於ipad。我只是得到一個空白的屏幕。我試着在頁面頂部添加一些文本來檢查頁面是否加載並且確實如此。該問題看起來像它與fb.login?facebook登錄無法在ipad上工作

<body> 
    <div id="fb-root"></div> 
    <script> 
      // This js didnt work, update the reload href further down !!! var currentUrl = 'https://www.facebook.com/pages/Mosquito-Digital/186527884694190?id=186527884694190&sk=app_629434517084781'; 
    var likesPage = false; 
    var addisPageId = 'xxxxxxxxx'; //got this from http://graph.facebook.com/pagename 


    window.fbAsyncInit = function() { 
    // init the FB JS SDK 
    FB.init({ 
     appId  : 'xxxxxxxxxxx',      // App ID from the app dashboard 
     channelUrl : '//myurl.com/channel.html', // Channel file for x-domain comms 
     status  : true,         // Check Facebook Login status 
     xfbml  : true         // Look for social plugins on the page 
    }); 
    FB.login(function(response) { 
     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) { 
        window.location = '/continuepage.aspx'; 
        //document.getElementById("likePage").style.display = "inline"; 
       } else { 
        document.getElementById("container_notlike").style.display = "inline"; 
       } 
      }); 
     } else { 
      window.parent.location = "https://www.facebook.com/xxxxx"; 
      //document.getElementById("nologin").style.display = "inline"; 
     } 
    }, {scope: 'user_likes'}); 
    // 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')); 
    </script> 

    <div id="container_notlike"> 
     <img src="/xxxxx/like-page-01.jpg" /> 
    </div> 

    <div id="container_like"> 
    </div> 
</body> 

回答

3

檢查您的Mobile Safari是否啓用了「Block Pop-Ups」。如果它被激活,FB.login將不會在沒有任何響應/提示/錯誤/任何情況下工作。

Instruction如何在Mobile Safari上停用彈出窗口阻止程序。

相關問題