Question

is there a callback function (e.g. onComplete) for this? I would like to display a loader.

FB.XFBML.parse()
Was it helpful?

Solution

Yes, the second parameter is the callback function. For example this should work:

FB.XFBML.parse(document.getElementById('some_element'), function() {
    alert('I rendered');
});

OTHER TIPS

To parse the whole page by the same time

FB.XFBML.parse(document, function(){
    alert('I rendered');
});

As of 2013 this does not work. Google Chrome will have "blinking" like buttons until it is finally rendered for me. This event is called before rendering is done.

To test this I try to hide the container before which has the like buttons (this works fine). Then I test to show the container in the function() { }); of the FB.XFBML.parse, that's when it looks like the newly loaded buttons are blinking.

Only having this issue in google chrome, but it proves that it's not after all like buttons have finished rendering in google chrome atleast.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top