调用FB.init()前调用FB.getLoginStatus() [英] FB.getLoginStatus() called before calling FB.init()

查看:125
本文介绍了调用FB.init()前调用FB.getLoginStatus()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查用户是否使用Facebook JavaScript JDK和jQuery登录了Facebook。
但即使超时10秒,我得到这个错误消息:

I want to check if a user is logged-in in facebook using the Facebook JavaScript JDK and jQuery. But even with a timeout of 10 seconds I get this error message:

FB.getLoginStatus()在调用FB.init()之前调用。

这是我的代码:

<script type="text/javascript" src="/js/jquery-1.2.3.pack.js" />
<div id="fb-root"></div>
<script src="http://connect.facebook.net/de_DE/all.js">  </script>
<script type="text/javascript">
    jQuery('document').ready(
    function(){
        FB.init({
                status : true, 
                cookie : true, 
                xfbml  : true 
        });

        setTimeout(function(){

            FB.getLoginStatus(function(response) {
                if (response.session) {
                      jQuery('div#likeButtonWhatsThisText').remove();
                }
            });         
        }, 10000)       
    }
    )
</script>

有关如何获得这项工作的任何想法?

Any ideas on how to get this work?

谢谢基督徒

推荐答案

我觉得你正在调用fb.init而不传递你的应用程序ID。应该是这样的

Hi I think you are calling fb.init without passing your application ID. It should be like this

FB.init({
        appId: "Your API ID",
        status: true,
        cookie: true,
        xfbml: true
});

我希望这可以工作。

这篇关于调用FB.init()前调用FB.getLoginStatus()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆