Facebook javascript sdk in Phonegap with ios?

Facebook javascript sdk in Phonegap with ios?

本文关键字:with ios Phonegap in javascript sdk Facebook      更新时间:2023-09-26

这是我的代码

<html>
    <head>
        <head>
            <title></title>
           <script type="text/javascript" charset="utf-8" src="cordova-1.6.0.js"></script>
           <script type="text/javascript">

                    function go()
                    {
                        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.');
                                 }
                                 });                        
                    }


                </script>
                <body>
                    <div id="fb-root">
                    </div>
                    <script>
                        window.fbAsyncInit = function() {
                            FB.init({
                                    appId      : '', // App ID
                                    channelUrl : '', // Channel File
                                    status     : true, // check login status
                                    cookie     : true, // enable cookies to allow the server to access the session
                                    xfbml      : true,  // parse XFBML
                                    oauth      : true  //oauth v2.0 
                                    });
                        };

                        // Load the SDK Asynchronously
                        (function(d){
                         var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
                         if (d.getElementById(id)) {return;}
                         js = d.createElement('script'); js.id = id; js.async = true;
                         js.src = "//connect.facebook.net/en_US/all.js";
                         ref.parentNode.insertBefore(js, ref);
                         }(document));
                        </script>
                    <input onclick="go();" type='submit' id='login-button' value='Login' name='login' >
                </body>
</html>

基本上,您单击该按钮,它应该向您显示一个登录弹出窗口。当我在普通浏览器中尝试时它可以工作,但是当我在iPhone模拟器中尝试时没有任何反应。Iv 还将 iPhone 浏览器设置为允许弹出窗口。我做错了什么?

我使用名为Childbrowser :)的phonegap插件让它工作