Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook API Request Dialog not working with Safari

I have the following code that logs the user in and displays the "Select Friends for Request" dialog ("apprequests"):

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
    <head>
    <title>Test</title>

    <script type="text/javascript">
    function facebook(){        
        FB.login(function(response) {
            if (response.authResponse) {
                var access_token = FB.getAuthResponse()['accessToken'];
                FB.ui({
                    method: 'apprequests',
                    message: 'Sample Title', 
                    max_recipients:1
                }, function(response){          
                    console.log('OK');
                });
            }
        }, {scope: 'publish_stream'});
    }
    </script>

    </head>

    <body>
    <p><a href="javascript:facebook();">Test</a></p>
    <div id="fb-root"></div>

    <script type="text/javascript">
    (function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/es_LA/all.js#xfbml=0&appId=XXXXXXXXXXXXXX";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
    </script>

    </body>
    </html>

The code is working with all major browsers (Firefox, Chrome, Opera, IE11, Safari for IOS, Android browser). Safari (for Mac/PC) is the exception: it's opening the "apprequests" dialog but the dialog comes up empty. If you change the dropdown options (to "Friends to Invite" and then to "All Friends" again) the friend list finally appears.

Any idea how to fix this bug?

Thank you!

like image 598
Edward Avatar asked Dec 27 '13 18:12

Edward


1 Answers

It is reported bug of Facebook-API. As mark wiltse stated here:

We have managed to reproduce this issue and it appears to be a valid bug. We are assigning this to the appropriate team.

There is no need to handle separately for safari. You just need to on-hold this task until this bug get resolved by facebook developer.

like image 196
Zaheer Ahmed Avatar answered Nov 19 '22 11:11

Zaheer Ahmed