Facebook JS SDK not loading on Safari Mobile (using iPad)

故事扮演 提交于 2019-12-11 01:13:02

问题


I am developing a Facebook App using JS SDK. Everything works fine on FF/Chrome/Safari, except on iPad where the SDK just won't load.

I tried it by using very simple code (most of it coming directly from Facebook's documentation), like that:

<!doctype html>
<html>
<head>

</head>
<body>
    <div id="fb-root"></div>
    <script src="//connect.facebook.net/en_US/all.js"></script>
    <script>


        /* All Facebook functions should be included 
        in this function, or at least initiated from here */


        window.fbAsyncInit = function() {




            FB.init({appId: MYAPPID, 
  status     : true, // check login status
  cookie     : true, // enable cookies to allow the server to access the session
  xfbml      : true  // parse XFBML
});




            FB.login(function(response) {
                if (response.authResponse) {
                    console.log('Welcome!  Fetching your information.... ');
                    FB.api('/me', function(response) {
                        console.log('Good to see you, ' + response.name + '.');


                    });
                } else {
                    console.log('User cancelled login or did not fully authorize.');
                }
            });

        };




        (function() {
            var e = document.createElement('script'); e.async = true;
            e.src = document.location.protocol +
                '//connect.facebook.net/en_US/all.js';
            document.getElementById('fb-root').appendChild(e);
        }());




    </script>
</div>

And nothing shows up. No popup (they are not blocked), no console.log, nothing. Is it an issue with my code or is Facebook SDK going crazy today? I saw nothing relevant on the platform status.

来源:https://stackoverflow.com/questions/10658413/facebook-js-sdk-not-loading-on-safari-mobile-using-ipad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!