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 had to use the Facebook AppID created for this application as AppID and I had to make sure that the domains are defined correctly.