Tip For Loading Feed Dialog on Page Load

author: Anna date: November 3, 2011

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

Want your Facebook fans to engage and share your brand?

We are specialists in virality. We look at how people share and why people share on Facebook. Learn more about creating your own viral Facebook app today.