Shani1351 Shani1351 - 3 years ago 191
PHP Question

invite friends in a dialog in a Facebook application

I'm trying to create a Facebook application that displays a friend invite dialog within the application using Facebook's Javascript API (FB.ui).

To do that I followed this tutorial

I have two problems:

  1. The action url I've put in the request-form is ""
    but I see that the iframe source after the post is ""
    and when this iframe tries to do:
    I get an error saying:

    "Permission denied for < > (document.domain has not been set) to get property Window.closeInviteWidget from <> (document.domain=<>)."

  2. The skip button inside the request-form opens the action url in a new window (new browser tab) and not post to itself like the invite button.

How can I fix those problems?

-------------------- UPDATE : --------------------------------

I've tried to do what ifaour said and changed the code to:

function inviteFriends(user_name, category_id, category_name)
url = appBaseUrl + "/index.php?category_id=" + category_id;
req = "<fb:req-choice url='" + url + "' label='Authorize My Application' />";
content = user_name + " opened a new category called " + category_name + ". " + req;
action = 'post_invite.php';

fbmi_text = '<fb:request-form action="' + action + '" target="_self" method="post" invite="true" type="Invite" content="' + content + '" <fb:multi-friend-selector showborder="false" actiontext="Invite yor friends" email_invite="false" import_external_friends="false" /> </fb:request-form>';


When I use FireBug and look at the invite form it looks like this:

<form id="req_form_4d20682f73ddb6e71722794" content="I've opened a new category called dsfsd. <fb:req-choice url='' label='Authorize My Application' /> type="Invite" invite="true" method="post" target="_self" action="">

But I still get the same error:

Permission denied for (document.domain has not been set) to get property Window.closeInviteWidget from (document.domain=

This are my app settings (I've added spaces because I can't add more links):

Site URL :

Canvas Page :

Canvas URL :

Canvas FBML/iframe : iframe

Post-Authorize Redirect URL :

Answer Source

Please have a read of the official Facebook document.

Also try using action="".

EDIT: I've just realized! are you using IFrame or FBML as canvas type?!
If you are using IFrame then fb:serverFbml is needed to use FBML within your IFrame.

Also please note that FBML will be deprecated:

We are in the process of deprecating FBML. If you are building a new application on, please implement your application using HTML, JavaScript and CSS. You can use our JavaScript SDK and Social Plugins to embedded many of the same social features available in FBML. While there is still functionality that we have not ported over yet, we are no longer adding new features to FBML.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download