2011-08-31 2 views

답변

0

JavaScript SDK로 이것을 수행하는 것에 대해 확실하지 않지만 PHP로 할 수 있다는 것을 알고 있습니다.

HTML 및 CSS로 표시하려는 상자를 만들어야합니다. 페이지에서 생성 할 때 서버가 버튼을 클릭하면 $ facebook-> getLoginUrl()에 의해 제공된 위치로 사용자가 이동합니다.

이것은 본질적으로 원하는대로 할 수 있습니다. JavaScript SDK를 사용하여 동일한 작업을 수행 할 수 있는지 확실하지 않습니다.

0
here what i am doing 

in "facebooklogin.aspx" is first page for login after login and permissions user redirect to xxx.aspx page where i am fetching user details. 

-- facebooklogin.aspx 

<head runat="server"> 
    <title>FaceBook Login</title> 
    <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" 
     type="text/javascript"></script> 
    <script type="text/javascript"> 

    function fblogin() 
    {  
     //<![CDATA[ 
      //Replace API key with yours from Facebook 
      var api_key = 'XXX'; 
      var channel_path = 'xd_receiver.htm'; 

      FB_RequireFeatures(["XFBML"], function() { 
       // Create an ApiClient object, passing app's API key and 
       // a site relative URL to xd_receiver.htm 
       FB.Facebook.init(api_key, channel_path); 
       FB.ensureInit(function() { 
        FB.Connect.showPermissionDialog("email,user_birthday,user_location", function(perms) { 
         if (!perms) { 
          //alert("No"); 
         } else { 
          //alert("yes"); 
          window.location ="http://xxx.aspx" 
         } 
        }); 
       }); 
      }); 
     //]]> 
    } 
    </script>  
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div id="divbtnfb"> 
     <a onclick="javascript:fblogin();">login</a> 
    </div> 
    </form> 
</body> 


--CODE BEHIND in XXX.aspx 

protected void Page_Load(object sender, System.EventArgs e) 
     { 
      if (ConnectAuthentication.isConnected()) 
      { 
       //Create instance of REST api using current authanticated session 
       Api api = new Api(CurrentSession); 
       //Display user data captured from the Facebook API. 
       try 
       { 
        Facebook.Schema.user user = api.Users.GetInfo(); 
        firstName.Text = user.first_name; 
        lastName.Text = user.last_name; 
        //for email use client code 
       } 
       catch 
       { 
        Response.Redirect("facebooklogin.aspx"); 
       } 
      } 
      else 
      { 
       Response.Redirect("facebooklogin.aspx"); 
      } 
} 


-- In facebooklogin.aspx its checking for permission, if user is not loggedin to facebook this script shows this lightbox. 
I want to change this lightbox 
관련 문제