我正在开发一个facebook应用程序,我们只需要在一个文本区域中请求一条消息。现在,我们在用户喜欢页面后直接请求扩展权限(应用程序被隐藏,直到用户喜欢页面)。我们希望它在提交表单时出现。
有没有办法在弹出式div (而不是新的window...jquery.load)中加载权限对话框?并使用脚本页面作为我的回调uri,并在不重新加载选项卡的情况下发布我的数据?如果使用普通表单,我已经这样做了,但我们需要从FB抓取名称/pic/email/bday才能放入数据库。
任何帮助,即使是在正确的方向上推动,都将非常感谢!
/**更新**/
我想要更新我想出的东西,它使用所有当前的SDK。我试着让它尽可能的模板化,这样其他人就可以使用它。
$("#submit").live('click',function() {
if (someErrors === true) {
// handle errors
} else {
FB.login(function(response) {
if (response.session) {
if (response.perms) {
FB.api('/me', function(response) {
// vars: response.session.uid, response.name, response.email, response.birthday, etc
// serialize data here for post
$.post("process.php",formData,function(data) {
if (data.error) {
// send json encoded error messages back to retrieve here like below:
// PHP: echo json_encode(array("error"=>"fail"));
} else {
/**
send data back json encoded:
PHP: echo json_encode(array("yourData"=>"{$yourData}","fb_id"=>"{$fb_id}","name"=>"{$name}"));
Now we have data like:
var profile = 'http://www.facebook.com/profile.php?id='+data.fb_id;
var image = '<img src="http://graph.facebook.com/'+data.fb_id+'/picture" />';
var yourData = data.yourData;
**/
}
}, "json");
});
} else {
// more errors
}
} else {
// and more errors
}
}, {perms:'email,user_birthday'}); // request your specific permissions here
}
return false;
});发布于 2011-05-05 12:52:15
权限对话框需要加载到弹出窗口或Facebook画布页面中,以防止点击劫持,所以 no ,没有办法做到这一点(尽管我很高兴被证明是错的)。
为了澄清一下,弹出窗口,我指的是authentication documentation中显示的表单:

当用户提交表单时,您可以触发此弹出窗口,如下所示:
$('#submit_btn').click(function() // could also listen to the .submit() event
{
// show popup
FB.login(function(response)
{
// use FB methods to get data you want,
// attach it to valid input fields
// submit form
$('#form').submit();
});
});https://stackoverflow.com/questions/5892780
复制相似问题