I use this Facebook Login Button code:
我使用这个Facebook登录按钮代码:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : 'myActualId',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
</script>
<fb:login-button show-faces="false" width="200" max-rows="1"></fb:login-button>
But the debug console gives me this error: FB.login() called before calling FB.init().
但调试控制台给我这个错误:在调用FB.init()之前调用了FB.login()。
I made a test page so my error can be seen: http://www.comehike.com/test_fb_connect.php
我做了一个测试页面,因此可以看到我的错误:http://www.comehike.com/test_fb_connect.php
I have no idea what I am doing wrong. Any help would be much appreciated!
我不知道我做错了什么。任何帮助将非常感激!
Thanks, Alex
谢谢,Alex
4 个解决方案
#1
25
You're loading the Facebook script all.js twice. It should be loaded only once.
您正在加载Facebook脚本all.js两次。它应该只加载一次。
#2
22
If you pass the non existing FB app key to init() then only you get the error of 'FB.login() called before calling FB.init()'
如果将不存在的FB应用程序密钥传递给init(),则只有在调用FB.init()之前才会收到“FB.login()调用的错误”
Make sure, you hadn't been doing the same.
确保你没有做同样的事情。
#3
1
Seeing as no one on the interwebs was able to answer my question, I wiped out the old Facebook app entirely (on my developers.facebook.com account) and just made a new app from scratch and made a totally new one.
看到互联网上没有人能够回答我的问题,我完全消灭了旧的Facebook应用程序(在我的developers.facebook.com帐户上),并从头开始制作了一个全新的应用程序并制作了一个全新的应用程序。
After that, the basic code did the job
在那之后,基本代码完成了这项工作
#4
-4
This worked for me
这对我有用
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
FB.init({
appId : true,
status : false, // check login status
cookie : false, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
</script>
#1
25
You're loading the Facebook script all.js twice. It should be loaded only once.
您正在加载Facebook脚本all.js两次。它应该只加载一次。
#2
22
If you pass the non existing FB app key to init() then only you get the error of 'FB.login() called before calling FB.init()'
如果将不存在的FB应用程序密钥传递给init(),则只有在调用FB.init()之前才会收到“FB.login()调用的错误”
Make sure, you hadn't been doing the same.
确保你没有做同样的事情。
#3
1
Seeing as no one on the interwebs was able to answer my question, I wiped out the old Facebook app entirely (on my developers.facebook.com account) and just made a new app from scratch and made a totally new one.
看到互联网上没有人能够回答我的问题,我完全消灭了旧的Facebook应用程序(在我的developers.facebook.com帐户上),并从头开始制作了一个全新的应用程序并制作了一个全新的应用程序。
After that, the basic code did the job
在那之后,基本代码完成了这项工作
#4
-4
This worked for me
这对我有用
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
FB.init({
appId : true,
status : false, // check login status
cookie : false, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
</script>