Sunday, 25 November 2012

Facebook Social

Login with Facebook Snippet


Javascript
function FBdoLogin() {                  
            FB.init({appId: '2342321234423', status: true, cookie: true,
                     xfbml: true});       

             FB.login(function(response) {
                if (response.authResponse) {
                   

                       success:function(data)
                           {  //success page call the
startApp();

   }


                          });                  
                   }
          },{scope: 'email,user_birthday,publish_stream'}); // getting permission from user
          }
 function startApp() {              
              var redirectUrl = path+'user/fbcheck';            
              window.top.location.href = redirectUrl;            
          } 


UI
* include the facebook all.js in header
<script src="http://connect.facebook.net/en_US/all.js"></script>

<a class="fblogin" href="javascript:void(0);" onclick="FBdoLogin();return false;"><img src="localhost/images/connect-facebook-button.png">


No comments:

Post a Comment