0

我正在努力解决这个问题。我喜欢的页面使用 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>
4

1 回答 1

3

Check if your Mobile Safari has "Block Pop-Ups" activated. If it's activated the FB.login won't work without any response/hint/error/whatever.

Instruction how to deactivate Pop-Up Blocker on Mobile Safari.

于 2013-07-30T08:37:07.163 回答