Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for FB.XFBML.parse callback function?

Tags:

xfbml

fbjs

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

FB.XFBML.parse()
like image 236
fabian Avatar asked Jul 13 '10 06:07

fabian


3 Answers

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

FB.XFBML.parse(document.getElementById('some_element'), function() {
    alert('I rendered');
});
like image 75
jhchen Avatar answered Oct 22 '22 07:10

jhchen


To parse the whole page by the same time

FB.XFBML.parse(document, function(){
    alert('I rendered');
});
like image 8
Remy Mellet Avatar answered Oct 22 '22 07:10

Remy Mellet


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.

like image 1
Elrinth Avatar answered Oct 22 '22 06:10

Elrinth