Dou*_*kem 10 javascript facebook social-networking
我正在尝试创建一个Facebook Connect应用程序,使用Facebook的Javascript API(通过FBMLPopupDialog)在页面中显示朋友邀请对话框.
问题是显示您使用的朋友邀请对话框 多朋友表单,需要action ="url"属性,该属性表示在用户完成或跳过表单时将页面重定向到的URL.问题是我想关闭FBMLPopupDialog(就像用户只是点击弹出对话框中的'X'按钮一样).我能做的最好的事情是将用户重定向回他们所在的页面基本上是重新加载,但是他们失去了所有AJAX/Flash应用程序状态.
我想知道是否有任何Facebook Connect开发人员遇到这个问题并且有一个很好的方法来简单地在他们的网站中显示朋友邀请"灯箱"对话框,他们不想在用户完成时"刷新"或"重定向" .
facebook connect JS API提供了一个FB.Connect.inviteConnectUsers,它提供了一个很好的对话框,但只连接了你的应用程序的现有用户,这些用户也有一个Facebook帐户但没有连接.
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;
}
Run Code Online (Sandbox Code Playgroud)
如果有人在2011年寻找类似的东西,请点击这里链接:http://developers.facebook.com/docs/reference/dialogs/requests/,您需要发送应用程序请求的代码段是:
FB.ui({method: 'apprequests', message: 'A request especially for one person.', data: 'tracking information for the user'});
Run Code Online (Sandbox Code Playgroud)
如果您在某处有此文件 xd_receiver.html,请确保使用站点的完整 url 正确指定 xd_receiver.html 文件的路径,如下所示:
http://www.yoursite.com/xd_receiver.html
归档时间: |
|
查看次数: |
36014 次 |
最近记录: |