I need to know when the Facebook page plugin is loaded, because sometimes it takes a lot of time, and it leaves a white space.
I've embedded the page plugin as facebook said
<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/es_LA/sdk.js#xfbml=1&version=v2.4&appId=XXXXXXX";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
And then as the facebook's example:
<div class="fb-page" data-href="https://www.facebook.com/facebook" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true" data-show-posts="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/facebook"><a href="https://www.facebook.com/facebook">Facebook</a></blockquote></div></div>
It works ok, but I need to know when it's loaded, so I can show it after all.
UPDATE
After lot of days, I just hide the box and show it after 1 minute, but sometimes it still not load the page. Any idea?
Thanks!
Use this code:
window.onload = function() {
FB.Event.subscribe('xfbml.render', function(response) {
console.log('rendered.... finally!');
});
};