Tip For Loading Feed Dialog on Page Load
The problem is: you’ve set up your Facebook JS/SDK footer. You’d like to pop up the publish dialog immediately upon page load. But you keep getting a “FB not available” error in the console, or the pop-up appears as if you’re not authenticated (and you are sure you are).
The solution is to put a 300 millisecond delay before you call the FB.ui function:
window.setTimeout(function(){
// your publish function
}, 300);
Why does this work? The FB object takes some time to set up, and it’s at the footer of your document. You’d expect JQuery to fully wait until the page and objects are loaded, but in reality it doesn’t (or the FB object just isn’t fully ready).
cateogories: App Development, Apps, Blog, Facebook, Tech