Facebook连接显示邀请朋友对话框并完成关闭 [英] Facebook connect displaying invite friends dialog and closing on completion
问题描述
我正在尝试创建一个Facebook Connect应用程序,在Facebook的Javascript API(通过 FBMLPopupDialog )。
I'm trying to create a Facebook Connect application that displays a friend invite dialog within the page using Facebook's Javascript API (through a FBMLPopupDialog).
麻烦的是显示一个你使用的朋友邀请对话框 需要action =url的多人表单属性,表示当用户完成或跳过表单时将页面重定向到的URL。问题是我想关闭FBMLPopupDialog(与用户刚刚点击弹出对话框上的X按钮相同的行为)。我可以做的最好的方法是将用户重定向到基本上重新加载的页面,但是它们失去了所有的AJAX / Flash应用程序状态。
The trouble is to display a friend invite dialog you use a multi-friend form which requires an action="url" attribute that represents the URL to redirect your page to when the user completes or skips the form. The problem is that I want to just close the FBMLPopupDialog (the same behavior as if the user just hit the 'X' button on the popup dialog). The best I can do is redirect the user back to the page they were on basically a reload but they lose all AJAX/Flash application state.
我想知道是否有Facebook Connect开发人员遇到这个问题,并且有一个很好的方法,只需在他们的网站中显示一个朋友邀请lightbox对话框,当他们不想在用户完成时刷新或重定向。
I'm wondering if any Facebook Connect developers have run into this issue and have a good way to simply display a friend invite "lightbox" dialog within their website where they don't want to "refresh" or "redirect" when the user finishes.
Facebook连接JS API提供了一个 FB.Connect.inviteConnectUsers ,它提供了一个很好的对话框,但只能连接您的应用程序的现有用户,他们也拥有一个Facebook帐户并且没有连接。
The facebook connect JS API provides a FB.Connect.inviteConnectUsers, which provides a nice dialog but only connects existing users of your application who also have a Facebook account and haven't connected.
http://bugs.developers.facebook.com/show_bug。 cgi?id = 4916
function fb_inviteFriends() {
//Invite users
log("Inviting users...");
FB.Connect.requireSession(
function() { //Connect succes
var uid = FB.Facebook.apiClient.get_session().uid;
log('FB CONNECT SUCCESS: ' + uid);
//Invite users
log("Inviting users...");
//Update server with connected account
updateAccountFacebookUID();
var fbml = fb_getInviteFBML() ;
var dialog = new FB.UI. FBMLPopupDialog("Weblings Invite", fbml) ;
//dialog.setFBMLContent(fbml);
dialog.setContentWidth(650);
dialog.setContentHeight(450);
dialog.show();
},
//Connect cancelled
function() {
//User cancelled the connect
log("FB Connect cancelled:");
}
);
}
function fb_getInviteFBML() {
var uid = FB.Facebook.apiClient.get_session().uid;
var fbml = "";
fbml =
'<fb:fbml>\n' +
'<fb:request-form\n'+
//Redirect back to this page
' action="'+ document.location +'"\n'+
' method="POST"\n'+
' invite="true"\n'+
' type="Weblings Invite"\n' +
' content="I need your help to discover all the Weblings and save the Internet! WebWars: Weblings is a cool new game where we can collect fantastic creatures while surfing our favorite websites. Come find the missing Weblings with me!'+
//Callback the server with the appropriate Webwars Account URL
' <fb:req-choice url=\''+ WebwarsFB.WebwarsAccountServer +'/SplashPage.aspx?action=ref&reftype=Facebook' label=\'Check out WebWars: Weblings\' />"\n'+
'>\n'+
' <fb:multi-friend-selector\n'+
' rows="2"\n'+
' cols="4"\n'+
' bypass="Cancel"\n'+
' showborder="false"\n'+
' actiontext="Use this form to invite your friends to connect with WebWars: Weblings."/>\n'+
' </fb:request-form>'+
' </fb:fbml>';
return fbml;
}
推荐答案
只要有人会寻找这是在2011年这样的链接: http://developers.facebook.com/文档/参考/对话框/请求/ ,以及发送应用程序请求的一段代码是:
Just if someone will look for something like this in 2011, here is link: http://developers.facebook.com/docs/reference/dialogs/requests/ , and piece of code that you need to send application request is:
FB.ui({method: 'apprequests', message: 'A request especially for one person.', data: 'tracking information for the user'});
这篇关于Facebook连接显示邀请朋友对话框并完成关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!