Facebook登录无法在ipad上运行

时间:2013-06-26 14:34:35

标签: javascript ipad facebook-graph-api

我正试图解决这个问题。我喜欢的页面使用facebook js sdk示例中使用的确切代码来查看用户是否喜欢该页面。这适用于所有桌面浏览器,但不适用于ipad。我只是得到一个空白的屏幕。我尝试在页面顶部添加一些文本来检查页面是否已加载并且确实已加载。问题与fb.login相似吗?

<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>

1 个答案:

答案 0 :(得分:3)

检查您的移动版Safari是否有&#34;阻止弹出窗口&#34;活性。如果它被激活,FB.login将无法正常工作而没有任何响应/提示/错误/无论如何。

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