What to do when Facebook's sdk.js takes too long or doesn't load?


I've a website, with a Sign in with Facebook button. The moment page loads, sdk.js is async loaded, and FB.init is called when it is done. The button's onclick calls FB.login. Nothing fancy.

However, in some cases, with a rare percentage of our users, it seems that sdk.js doesn't load, or maybe takes too long to load. That is, when they click the Sign in with Facebook button, I get a JS error saying FB is not defined.

What can/should I do here?

  • wait? setTimeout? Not sure how exactly.
  • Show a helpful message to user and ask him to reload the page, and try again, and if problem persists, contact support?
  • anything else?


Show source
| javascript   | facebook   | facebook-login   2017-01-07 07:01 0 Answers

Answers ( 0 )

◀ Go back