我想在我的网站上使用新的Facebook图形API。这是我有:Facebook图形API:调用FB.init()之前调用FB.login()
某处在页面上:
<fb:login-button autologoutlink="true" perms="email,user_birthday,status_update,publish_stream"></fb:login-button>
右边的标签后:
<div id="fb-root">
</div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({ appId: '<%= ConfigurationManager.AppSettings["FBAppId"] %>', status: true, cookie: true, xfbml: true });
/* All the events registered */
FB.Event.subscribe('auth.login', function (response) {
// do something with response
alert("login success");
});
FB.Event.subscribe('auth.logout', function (response) {
// do something with response
alert("logout success");
});
FB.getLoginStatus(function (response) {
if (response.session) {
// logged in and connected user, someone you know
alert("login success");
}
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
,但是当我点击生成的登录按钮,没有任何反应。
另外,我在Firebug的控制台获得
FB.getLoginStatus() called before calling FB.init().
。
任何想法?
这意味着,我没有传递一个关键FB.init方法。 – sabbour 2010-07-26 16:40:31
我有同样的问题,但只有在MAC OSX的FF,它适用于所有其他浏览器。请帮助我。检查我的问题http://stackoverflow.com/questions/3338198/facebook-login-plugin-issue-with-ff-on-mac-osx – Nnp 2010-07-27 00:08:57
你可以请发布整个工作代码。我在这里遇到同样的问题。谢谢 – Intellix 2011-02-03 12:13:39