<
a
href
=
"javascript:;"
id
=
"invite"
>Invite your friend</
a
>
<
div
id
=
"fb-root"
></
div
>
<script type="text/javascript">
FB.init({
appId: appid,
status:
true
,
cookie:
true
,
xfbml:
true
,
oauth:
true
});
$(
'#invite'
).click(
function
(){
FB.getLoginStatus(checkResponse);
});
function
checkResponse(response) {
if
(!response.authResponse) {
FB.login(handleSessionResponse);
}
else
{
inviteFriends();
}
}
function
handleSessionResponse(response) {
if
(!response.authResponse) {
return
;
}
else
{
inviteFriends();
}
}
function
inviteFriends() {
var
uiSize = FB.UIServer.Methods[
"fbml.dialog"
].size;
FB.UIServer.Methods[
"fbml.dialog"
].size = {width:620, height:560};
FB.ui(
{
method:
'apprequests'
,
display:
'popup'
,
message:
"[文字说明]"
},
function
( response ){
FB.UIServer.Methods[
"fbml.dialog"
].size = uiSize;
}
);
}
</script>