FB.getLoginStatus() called before calling FB.init()

后端 未结 6 940
北恋
北恋 2020-12-08 04:18

I\'ve this message in my console

FB.getLoginStatus() called before calling FB.init(). 

My code



        
6条回答
  •  广开言路
    2020-12-08 04:45

    Warning: some speculation below. If that's not OK, I can delete it.

    I'd assume that the problem lies in loading the SDK asynchronously but the Like button inline. Then it's possible that the Like button calls getLoginStatus before the script has loaded. You can test/verify this by commenting out the script to load the SDK asynchronously and instead include it as a normal script tag in the page head.

    Of course, that's just the easy way to test. If you can verify that as the problem, the "proper" way to solve it would probably be to ensure that the Like button doesn't appear on the page until the SDK has loaded.

提交回复
热议问题