thats my Code – it’s the new HTML5-Way to include the JS-FB-Api:
<div id="fb-root"></div>
<script>
(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/de_DE/all.js#xfbml=1&appId=XXXXXXXXXXXXXXXXX";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
That’s working good.. for Like-Buttons and somethings else. But if I want to use FB.Event.subscribe..:
window.fbAsyncInit = function() {
FB.Event.subscribe('edge.create', function(response) {
$('#head h1 a').text('liked');
});
$('#head h1 a').text('loaded');
}
…Firebug told me that FB is not defined. But window.fbAsyncInit was fired successfully.. so where is the problem?
Thanks for ur answers and sorry for my bad English!
I had the same problem, I could use it with Firefox, although FireBug was pointing out there is some error.
I couldn’t use it with Chrome, and its console said that FB is not defined.
Then I tried it like this, and it works:
And this works, no errors like FB.init already called or anything like it 🙂