zoukankan      html  css  js  c++  java
  • Facebook “Invite” 弹出窗口

    <!-- invite 按钮 -->
    <a href="javascript:;" id="invite">Invite your friend</a>
     
    <!-- facebook 相关 -->
    <div id="fb-root"></div>
    <script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
    <script type="text/javascript">
        FB.init({
            appId: appid, // 注意替换正确的facebook app id
            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() {
            // 调整窗口大小,仅对 display:'popup' 有效
            var uiSize = FB.UIServer.Methods["fbml.dialog"].size;
            FB.UIServer.Methods["fbml.dialog"].size = {620, height:560};
     
            FB.ui(
                {
                    method: 'apprequests',
                    display: 'popup', // popup 是 打开新窗口, dialogue 是 inline 窗口
                    message: "[文字说明]"
                },
                function( response ){
                    FB.UIServer.Methods["fbml.dialog"].size = uiSize;
                }
            );
        }
    </script>
  • 相关阅读:
    SQL Serever学习16——索引,触发器,数据库维护
    微信WeUI基础
    SQL Serever学习15——进阶
    SQL Serever学习14——存储过程和触发器
    微信WeUI入门2
    微信WeUI入门
    数据库—索引
    数据库—四种存储引擎
    视图
    事务
  • 原文地址:https://www.cnblogs.com/booth/p/2268643.html
Copyright © 2011-2022 走看看