javascript - FB init function gives wrong version error -


i'm using facebook js sdk, , have created new app today. configured properly. using init function like:

window.fbasyncinit = function() {     fb.init({       appid      : 'xxxx', // app id       status     : false,        version:  'v2.0',       cookie     : true,        xfbml      : false  // parse xfbml     }); };      (function(d, s, id){          var js, fjs = d.getelementsbytagname(s)[0];          if (d.getelementbyid(id)) {return;}          js = d.createelement(s); js.id = id;          js.src = "//connect.facebook.net/pl_pl/sdk.js";          fjs.parentnode.insertbefore(js, fjs);        }(document, 'script', 'facebook-jssdk')); 

but have error: "uncaught error: init not called valid version " trying other versions like: 2.1, 2.2 , still no luck. doing wrong here?

**disclaimer - purely speculation. seems have solved problem.


i've had issue on recent project. think latency issue. facebook sdk requires <div id="fb-root"></div> on page. should first thing after opening body tag. after this, may see initialization code.

for me, issue not consistent. see bug , not. thus, conclusion of being latency problem. if sdk cannot find fb-root, must create one. herein, believe latency issue exists.

try adding after opening body tag, before fb.init({});.

<div id="fb-root"></div> 

this seems have solved issue me , others well. v1.0 documentation discusses reason fb-root, v2.0 docs make no mention of item, because init script add if not find it.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -