views:

426

answers:

1

I don't see any way to respond to a timeout issue if Facebook is down or not responding when I use FB.init. There's no option here: http://wiki.developers.facebook.com/index.php/JS%5FAPI%5FM%5FFB.Bootstrap.Init%5F2

Would be nice if there were some way to respond to errors like you can with normal xmlhttprequests. Is there such a thing with Facebook Connect?

+2  A: 

As far as I know, you cannot gracefully handle timeouts with FB.init.

That's why I never use FB.init directly. Instead, I always call FB_RequireFeatures. This wraps the FB.init call so that I can deal with errors and degrade gracefully. What I do is write my own function that checks whether Facebook Connect initialized correctly and then does something appropriate if it did not.

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 that seems hacky, well... it is. :-)

Portman