How to handle Facebook Connect timeout
I don't see any way to answer the timeout question if Facebook is down or unresponsive when I use FB.init. There is no option here: http://wiki.developers.facebook.com/index.php/JS_API_M_FB.Bootstrap.Init_2
It would be nice if there is some way to react to errors as you can using regular xmlhttprequests. Is there such a thing with Facebook Connect?
source to share
As far as I know, you cannot handle timeouts intelligently with FB.init.
This is why I never use FB.init directly. Instead, I always call FB_RequireFeatures . This wraps the FB.init call so that I can handle errors and degrade gracefully. What I do is write my own function that checks that Facebook Connect is initialized correctly and then does something appropriate if it doesn't.
For example:
FB_RequireFeatures(["Connect"], function() {
FB.init("API_KEY", "xd_receiver.htm");
myPostConnectFunction();
});
function myPostConnectFunction() {
// Check for success of FBconnect, and deal with errors accordingly.
};
If this seems like a hack, well ... it is. :-)
source to share