views:

539

answers:

1

Hello there!

For some time now I try to figure out how these guys were able to add "Sign online here" button which is "install App" button on their fan-page tab:

http://www.facebook.com/GuinnessIreland?v=app_165491161181

I've read around the web and couldn't come up with any solid solution. The FBML and FBJS documentation left me with nothing.

So please, if anyone can help me with this.

NOTE: To make multiple tests on the Ajax request that are sent, do not accept the App install. It behaves differently after that.

+4  A: 

I had some problems with finding out about it as well. There is no info about this kind of behavior in wiki or anywhere. I got it working after trying some possible solutions and the simplest one is to make user interact with content embedded in fan page tab such as click on something etc. Then you need to post an ajax request with requirelogin parameter to pop up to come out. The simple example would be:

user_ajax = function() {
  var ajax = new Ajax();
  ajax.responseType = Ajax.RAW;
  ajax.requireLogin = true;
  ajax.ondone = function(data) {
      new Dialog(Dialog.DIALOG_POP).showMessage('Status', data, button_confirm = 'Okay');
  }
  var url = "http://yourappurl.com/request_handler"
  ajax.post(url);
  }

And the trigger for it:

<a href="#" onclick="user_ajax();return false;">Interaction</a>

Then if user is known to be using your application (fan page tab) you can prompt him for additional permission like publish stream or email communication by calling:

Facebook.showPermissionDialog('publish_stream,email');

Hope this solves the problem.

Karol Janyst

related questions