【发布时间】:2025-12-28 15:25:11
【问题描述】:
我在这个问题上苦苦挣扎了几个小时,但没有成功的迹象。我正在尝试实现 facebook 登录。这是我的代码:
function fblogin() {
FB.login(function(response) {
if (response.authResponse) {
var url = '/me?fields=name,email';
FB.api(url, function(response) {
$('#email_login').val(response.email);
$('#pwd_login').val(response.name);
$('#sess_id').val(response.id);
if($('#evil_username').val()==""){
$('#loginform').submit();
}else{
// doh you are bot
}
});
} else {
// cancelled
}
}, {scope:'email'});
}
但是一旦我点击 facebook 登录按钮,我就会在控制台中收到 too much recursion。这是为什么?我在*中阅读了很多关于这个问题的问题,但找不到我的案例的线索。
我这里没有递归,但是导致递归的原因是什么?
并且有来自
的电话window.fbAsyncInit = function() {
FB.init({
appId : 'xxxxxxxxxxxxx',
channelUrl : '//www.mydomain.de/channel.html',
status : true,
cookie : true,
xfbml : true
});
// Additional init code here
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
// connected
} else if (response.status === 'not_authorized') {
// not_authorized
fblogin();
} else {
// not_logged_in
fblogin();
}
});
};
还有来自触发fblogin() 的普通LOGIN 按钮。
【问题讨论】:
-
你怎么称呼这个?
-
设置
event.preventBubble = true -
@SLaks,请查看我的更新。我添加了我如何调用 fblogin() 的代码
标签: javascript jquery facebook-login