Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Facebook iframe弹出窗口_Javascript_Facebook - Fatal编程技术网

Javascript Facebook iframe弹出窗口

Javascript Facebook iframe弹出窗口,javascript,facebook,Javascript,Facebook,我不能让它工作。我试图展示一些东西(参见“发送到多个”部分的图片)。我收到消息“发生错误,请稍后再试。” 守则: window.fbAsyncInit = function() { FB.ui({title: 'title', display: 'iframe', method: 'apprequests', message: 'check this out.' }); } 编辑1: 弹出窗口显示,但里面没有朋友列表,只有上面的消息 编辑2: 当然,我的应用程

我不能让它工作。我试图展示一些东西(参见“发送到多个”部分的图片)。我收到消息“发生错误,请稍后再试。”

守则:

window.fbAsyncInit = function() {
    FB.ui({title: 'title', display: 'iframe', 
        method: 'apprequests', message: 'check this out.'
    });
}
编辑1: 弹出窗口显示,但里面没有朋友列表,只有上面的消息

编辑2:
当然,我的应用程序在第一次启动时会请求用户朋友列表的权限。

我已经测试了您的代码,并获得了所有用户的对话框加载

我建议检查您的应用程序id以确保它是正确的

下面是我正在使用的代码:

            //run the script code to get the facebook javascript sdk
            (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);
            }());

            //run when sychronisation of facebook javascript sdk is finished
            window.fbAsyncInit = function(){
                //initialise the application 
                FB.init({appId: '<?=APPLICATION_ID?>', status: true, cookie: true, xfbml: true, oauth: true});
                FB.ui({title: 'title', display: 'iframe', method: 'apprequests', message: 'check this out.'
                    }); 
            };
//运行脚本代码以获取facebook javascript sdk
(功能(){
var e=document.createElement('script');
e、 异步=真;
e、 src=document.location.protocol+'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
//facebook javascript sdk同步完成后运行
window.fbAsyninit=函数(){
//初始化应用程序
init({appId:'',状态:true,cookie:true,xfbml:true,oauth:true});
ui({title:'title',display:'iframe',method:'apprequests',message:'checkthis'
}); 
};

我已经测试了您的代码,并与所有用户一起加载了对话框

我建议检查您的应用程序id以确保它是正确的

下面是我正在使用的代码:

            //run the script code to get the facebook javascript sdk
            (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);
            }());

            //run when sychronisation of facebook javascript sdk is finished
            window.fbAsyncInit = function(){
                //initialise the application 
                FB.init({appId: '<?=APPLICATION_ID?>', status: true, cookie: true, xfbml: true, oauth: true});
                FB.ui({title: 'title', display: 'iframe', method: 'apprequests', message: 'check this out.'
                    }); 
            };
//运行脚本代码以获取facebook javascript sdk
(功能(){
var e=document.createElement('script');
e、 异步=真;
e、 src=document.location.protocol+'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
//facebook javascript sdk同步完成后运行
window.fbAsyninit=函数(){
//初始化应用程序
init({appId:'',状态:true,cookie:true,xfbml:true,oauth:true});
ui({title:'title',display:'iframe',method:'apprequests',message:'checkthis'
}); 
};

您应该使用函数getLoginStatus,以确保
FB.init
函数已完成加载

我只是这样解决了同样的问题:

注意,我使用的是jQuery


$(文档).ready(函数(){
init({appId:'APP_ID',status:true,cookie:true,xfbml:true,oauth:true});
FB.getLoginStatus(函数(响应){
ui({title:'Invite friends',display:'iframe',method:'apprequests',message:'check this out.});
});
});

您应该使用函数getLoginStatus,以确保
FB.init
函数已完成加载

我只是这样解决了同样的问题:

注意,我使用的是jQuery


$(文档).ready(函数(){
init({appId:'APP_ID',status:true,cookie:true,xfbml:true,oauth:true});
FB.getLoginStatus(函数(响应){
ui({title:'Invite friends',display:'iframe',method:'apprequests',message:'check this out.});
});
});

是否尝试删除
显示:“iframe”
?我想你不需要它。我希望弹出窗口显示在iframe中,所以我实际上需要它:)你是否尝试删除
display:'iframe'
?我想你不需要它。我希望弹出窗口显示在iframe中,所以我实际上需要它:)这可能是facebook js的问题(经常发生)-现在我不记得我做了什么来解决这个问题,但我确信我的应用id是正确的。无论如何,谢谢。这可能是facebook js的问题(经常发生)-现在我不记得我做了什么来解决这个问题,但我确信我的应用程序id是正确的。无论如何谢谢你。