How to make a pop up to ask user for extended permission in an i-frame application

风流意气都作罢 提交于 2020-04-16 02:26:12

问题


I am trying to build a facebook app using iframe (not fbml). I am using php client. after trying a lot I'm not able to publish stream also I am not able to create a pop up to ask user for extended permission. I have used the following:

function facebook_prompt_permission(permission) 
{
    ensure_init(function() 
    {
        //check is user already granted for this permission or not
        FB.Facebook.apiClient.users_hasAppPermission(permission,
           function(result) {
               // prompt offline permission
               if (result == 0) 
               {
                  alert(result);
                  // render the permission dialog
                  FB.Connect.showPermissionDialog(permission,function(result)
                  {
                        if (result == null)
                            alert('no permissons granted');
                        else
                            alert('permissions ' + result);
                  },true,null);
               } 
               else 
               {
                   // permission already granted.
                   alert("permission already granted");
               }
       });
   });
}




facebook_prompt_permission('publish_stream');

The response for checking the permission comes as 0 but when I try FB.Connect.showPermissionDialog to show pop up to ask user for permission nothing happens; no pop up.


回答1:


/* Need to check this user has the permissions to post to wall etc....*/
if (!$facebook->api_client->users_hasAppPermission("publish_stream")) {
    // Redirect for permissions
    $url = "http://www.facebook.com/connect/prompt_permissions.php?api_key=$apikey&v=1.0&ext_perm=publish_stream&next=[YOURAPPURL]";
    header("Location: $url");
    exit;
}


来源:https://stackoverflow.com/questions/1426681/how-to-make-a-pop-up-to-ask-user-for-extended-permission-in-an-i-frame-applicati

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!