So basically, I'm working on a Facebook login flow for my website. It's fairly basic, but giving me some problems. The issue appears that the click observer is only working some of the time. A hard refresh will typically fix the problem. The following is my JS code used to get into it...
function fb_login(login_destination)
{
FB.login(function(response) {
if (response.authResponse) {
var fb_auth_token = response.authResponse.accessToken;
var fb_user_id = response.authResponse.userID;
var url = '/login/ajax/fb_login.php?fb_auth_token=' + fb_auth_token + '&fb_user_id=' + fb_user_id + '&fb_login=' + login_destination;
window.location = url;
}
}, {scope: 'email,user_about_me'});
}
document.observe("dom:loaded", load_fb);
function load_fb()
{
window.fbAsyncInit = function(){
FB.init({
appId : 'ID'
status : true,
cookie : true,
xfbml : true,
oauth : true
});
};
$('fb_connect').observe('click',function(event){
var login_destination = $('fb_connect').getAttribute('dest');
fb_login(login_destination);
});
}
The only symptom appears to be that it simply will not respond to clicks on certain page loads. The ID I'm using is tied directly to the image itself. I'm curious if anyone has ran into this and knows how to fix it. Thanks.