I've been seeing this behavior too, so please let me know if you found it what caused it.
In the meantime, I came up with a workaround:
This code first checks to see if the user is logged into Facebook (that seems to be the only case where the button does not show sometimes). Then, it checks whether the Facebook login button appeared successfully. If it did appear, we hide the "Back-up button".
Use JS to check login status:
*Note that I'm using JQuery code ($(...) to check for the existence of the button (any element with a class of ".fb_button") and to hide backup button. If you are not using Jquery, you will have to use some standard Javascript.
function fbLoginBandaid() {
FB.getLoginStatus(function(response) {
console.log( response );
if ((response.status)&&(response.status=='connected')) {
//They are logged into Facebook and are connected to our site.
//if the Facebook button did not render, we'll show the backup
if ($('.fb_button').length > 0) {
$('.fbloginbackup').hide();
}
}
} else if ((response.status)&&(response.status=='notConnected')){
//They are logged into facebook but not connected to this site
//if the Facebook button did not render, we'll show the backup
if ($('.fb_button').length > 0) {
$('.fbloginbackup').hide();
}
}
});
}
FB Init code:
window.fbAsyncInit = function() {
/*...ALL YOUR NORMAL CODE HERE */
fbLoginBandaid(); //bandaid fixes facebook button not showing sometimes. This forces display of a backup button we've made. Sometimes, this cuases two working buttons to show: ours and the Facebok one that should always be appearing.
};
Now, put a "backup" button in your HTML:
<!--Backup Button -->
<a class="fbloginbackup" title="Login with Facebook" href="#" onclick="INSERT_YOUR_LOGIN_SCRIPT(); return false;"><img src="insert_your_button_here.png" width="154" height="22" /></a>
<!-- Button that was supposed to work all the time -->
<fb:login-button length="long" autologoutlink="false" onlogin="fbLogin()"></fb:login-button>
Presumably you have a login script that handles Login for users that are already logged into Facebook, since you will not be presenting the Facebook login window.
Hope this helps.