I use this code to prepare the usage of the FaceBook API:
(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/en_GB/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'facebook-jssdk'));
However, on document load I get the error of:
FB.getLoginStatus() called before calling FB.init().
I don't understand this message. I've googled for this problem and found some forum threads, but unfortunately they were not helpful at all. I have decided to post a question here about this problem, as I am unable to resolve it, because I'm noob about Facebook API. Sorry if my question is too simple to anyone and thanks in advance for any answer.
I have the same Facebook Log
***FB.getLoginStatus() called before calling FB.init().***
when document load. I find out that the #xfbml=1
in the end of
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
make this error. After deleting #xfbml=1
, it's fine!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With