tags:

views:

1393

answers:

2

Hi

How can I show a typical facebook modal help dialog when the user clicks on one of the links on my Facebook app?

Thanks.

+2  A: 

Literally a 5 second google.

http://wiki.developers.facebook.com/index.php/Fb:dialog

codebliss
This is only helpful if they're using FBML, which from what I understand, not many people do.
Daniel Schaffer
Thanks. I did get to fb:dialog from google search but couldn't find out how to close the dialog from a button click. the egs show how to call another script. and i wanted to avoid fbml as far as possible. Found more help here (if someone is using fbml) - http://apifacebook.blogspot.com/2009/06/dialog-boxes.html
lostInTransit
+6  A: 

If you're using an IFrame app, you can use FB.UI.PopupDialog from the JS API. The bad news is that there is zero documentation for this feature, and it isn't very easy to use. The good news is that I've already figured it out! :)

// First, define the HTML content you want in the dialog as a javascript string:
var content = '<div><h2>Help is here!</h2><div>Hint: you can eat the cookies!</div></div>';

// Then add the content to this resource dictionary thing, wrapped in a div with the id "RES_ID[your identifier here]"
FB.UI.DomResources.addResourceDict(new FB.UI.DomResDict('<div id="RES_IDhelp01">' + content + '</div>'));

// Instantiate the popup dialog and show it:
var popup = new FB.UI.PopupDialog('Help?!', FB.UI.DomResources.getResourceById('help01'), false, false);
popup.show();

Of course, these bits can be spread out through your page as required, and you can use php to generate the html content for you.

Easy, right? :D Enjoy!

Daniel Schaffer
Please don't ask how long it took me to figure this out. It wasn't pretty.
Daniel Schaffer
<div id="RES_IDhelp01"> should be <div id="RES_ID_help01"> from my testing
marshall