1
我使用PHP SDK 3.x.x和Javascript SDK的混合登录到Facebook身份验证。当我们点击登录按钮时,出现窗口,填写凭证并提交后不会刷新页面。 FB.Event.subscribe('auth.login')似乎没有触发。问题是什么?Facebook身份验证登录不刷新页面
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $facebook->getAppId(); ?>',
oauth : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// whenever the user logs in, we refresh the page
FB.Event.subscribe('auth.login', function(response) {
window.location.reload();
});
FB.Event.subscribe('auth.logout', function(response) {
window.location.reload();
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
控制台中是否有错误? – sarnold 2012-01-11 02:13:20
nope。 :(我认为会有一些js错误,但没有。 – Blueboye 2012-01-11 02:51:31
你可以从这里找到解决这个问题:http://stackoverflow.com/questions/7141762/fb-event-subscribe-and-login-button – 2012-01-13 08:49:03