FB init function gives wrong version error

后端 未结 20 1385
故里飘歌
故里飘歌 2020-12-08 18:18

I\'m using the Facebook JS sdk, and I have created a new App today. Everything is configured properly. Using init function like:

window.fbAsyncInit = functio         


        
20条回答
  •  孤城傲影
    2020-12-08 19:07

    **Disclaimer - This is purely speculation. Seems to have solved my problem.


    I've had this issue on a recent project. I think this is a latency issue. The Facebook SDK requires that

    be on the page. This should be the first thing after the opening body tag. After this, you may see your initialization code.

    For me, this issue was not consistent. I would occasionally see the bug and sometimes I would not. Thus, my conclusion of it being a latency problem. If the SDK cannot find the fb-root, then it must create one. Herein, is where I believe the latency issue exists.

    Try adding this just after your opening body tag, but before your FB.init({});.

    This seems to have solved the issue for me and will hopefully help others as well. The v1.0 documentation discusses the reason for fb-root, but the v2.0 docs make no mention of the item, likely because the init script will add it for you if it does not find it.

提交回复
热议问题