5

The initialization code:

window.fbAsyncInit = function() {
    var bheight = $(document).height() + 50;
    FB.init({
        appId: appid,
        frictionlessRequests : true,
        status: true,
        cookie: true,
        xfbml: true,
        oauth: true});
    FB.Canvas.setSize({ width:760,height:bheight });
};

// Load the SDK Asynchronously
(function(d){
   var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
   if (d.getElementById(id)) {return;}
   js = d.createElement('script'); js.id = id; js.async = true;
   js.src = "//connect.facebook.net/en_US/all.js";
   ref.parentNode.insertBefore(js, ref);
 }(document));

The following code is called with an onclick:

function sendRequestViaMultiFriendSelector(msg){
    FB.ui({      
        method: 'apprequests',
        message: msg
    });
}

The popup is shown and the user can select some friends, but after submitting or cancelling, the window goes blank. The pop up is still there but white and empty. No errors logged in Firebug.

If I add a callback function it's never reached.

I've tried adding a self closing redirect_uri (redirect_uri: 'http://.../self_close.html') but after submitting the popup redirects to self_close.html and even when the content of that html is just <script type="text/javascript">window.close(); </script> the popup won't close nor send the request to the selected friends.

Strangely enough a couple weeks ago this was working, you could select some friends and send them invitations and the popup would close.

My app is running in localhost, is in Sandbox mode and I've tried inviting other App's admins, test users, normal users, etc. In the past it used to work.

What could be happening now?

Similar questions that I've check:

Thanks in advance!

UPDATE

I've added a test method using method:feed instead of method:apprequests

function feed_test() {
    // calling the API ...
    var obj = {
      method: 'feed',
      name: 'Feed test',
      caption: 'Test',
      description: 'Test'
    };

    function callback(response) {
      document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
    }

    FB.ui(obj, callback);
  }

When I call upon this method with an onclick the popup is shown, I enter my comment, submit it and the popup goes blank too. The popup is not closing but the post is published in my wall.

UPDATE 2

I've realized that if I open the app in the browser, outside Facebook (using http://facebookapp.localhost/) the apprequest works fine and it opens the popup without the disabled address bar. When I try to invite friends inside FB the popup is shown with a gray address bar containing this:

https://www.facebook.com/dialog/apprequests?api_key=XXXXXXXXXX&app_id=XXXXXXXXXX&display=popup&frictionless=true&locale=en_US&message=XXXX&next=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D5%23cb%3Df2b013bbfaa712%26origin%3Dhttp%253A%252F%252Ffacebookapp.localhost%252Ff3267a4c771122%26domain%3Dfacebookapp.localhost%26relation%3Dopener%26frame%3Df3ad1f46b651196%26result%3D%2522xxRESULTTOKENxx%2522&sdk=joey

I wonder what could be the difference in using the app inside and outside FB, may be there are some js problems.

FIXED

Today I tryied again and the problem was gone. Also even when the popup wasn't closing and the callback function wasn't being called the invitations were sent. My test users forgot to check it they were getting them... anyway, mysterious bug, mysterious fix.

Community
  • 1
  • 1
Jay
  • 81
  • 1
  • 6

0 Answers0