Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8307729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:35:39+00:00 2026-06-08T18:35:39+00:00

I succeed to integrate FBConnect in my application. Connection and register pages worked fine.

  • 0

I succeed to integrate FBConnect in my application. Connection and register pages worked fine.

But since a while, when I click on facebook button, the events I had bound are not raise anymore.

<script src="http://connect.facebook.net/fr_FR/all.js" ></script>
<script type="text/javascript">
//console integration
if(typeof console !== 'object')
console = {};
if((typeof console.debug) !== 'function'){
    if(typeof opera === 'object'){ 
        console = {
            debug : function(){return opera.postError(arguments);},
            info : function(){this.debug('[INFO] ',arguments);},
            log : function(){this.debug('[LOG] ',arguments);}
        };
    }
    else{ 
        console = {
            debug : function(){return true;},
            info : function(){return true;},
            log : function(){return true;}
        };
    }
}

/**
 * Fonction called to init and manage FB Connection
 */
handleFacebook();
$('#fb-button').click(function(){
    alert('ok');
    fbGetLoginStatus();
});

/**
 * 
 */
function handleFacebook() {
    if(!window.fbApiInit) {
        FB.init({appId: 'myAppId', xfbml: true, cookie: true});
        fbApiInit = true;
    }
}

function fbGetLoginStatus() {
    FB.getLoginStatus(function(response) {
        onStatus(response); // once on page load
        FB.Event.subscribe('auth.statusChange', onStatus); // every status change
    });
}

/**
* This will be called once on page load, and every time the status changes.
*/
function onStatus(response) {
    console.info('onStatus', response);
    if (response.status == 'connected') {
        console.info('User logged in');
        if (response.perms) {
            console.info('User granted permissions');
        }else{
            console.info('User has not granted permissions');
        }
        getAccountInfo();
    } else {
        console.info('User is logged out');
    }
}

/**
* This assumes the user is logged out, and renders a login button.
*/
function showLoginButton() {
    var button = '<fb:login-button perms="email" />';
    $('#fb-login-button').html(button);
    FB.XFBML.parse(document.getElementById('fb-login-button'));
}

function getAccountInfo() {
    FB.api(
        {
        method: 'fql.query',
        query: 'SELECT username, first_name, last_name, uid, email, sex  FROM user WHERE uid='+FB.getUserID()
        },
        function(response) {
            console.info('API Callback', response);
            var user = response[0];

            $('#usernamefb').val(user.username);
            $('#mailfb').val(user.email);

            $('#facebook-connect-form').submit();
        }
    );
}
</script>
<div id="fb-login-button">
    <fb:login-button perms="email" id="fb-button" />
</div>
<form method="post" action="/facebook-connect" id="facebook-connect-form">
    <input type="hidden" id="usernamefb" name="usernamefb"/>
    <input type="hidden" id="mailfb" name="mailfb"/>
</form>

I notice that the alert function in the $(‘#fb-button’).click event is never called.
It is not showed here but I include jQuery library upper in my file.
Any idea ?

Thanks for your answers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:35:41+00:00Added an answer on June 8, 2026 at 6:35 pm

    Facebook changed their button, and i didn’t find a way to bind click Events to it after their change.

    I changed my Website to Subscribe to the FB Event on Load.
    When you initialize FB you have to set the Option “status” to false to prevent an automatic Loginstatus-Check on init!

    function fbInit() {
            window.fbAsyncInit = function () {
                FB.init({
                    appId: 'XXX',
                    status: false,
                    cookie: true,
                    xfbml: true
                });
    
                //auth.statusChange
                FB.Event.subscribe('auth.authResponseChange', function (response) {
                    if (response.status.indexOf('connected') != -1) {
                        // the user is logged in and has authenticated your
                        // app, and response.authResponse supplies
                        // the user's ID, a valid access token, a signed
                        // request, and the time the access token 
                        // and signed request each expire
                        var uid = response.authResponse.userID;
                        var accessToken = response.authResponse.accessToken;
    
                        //Handle the access token
                        jQuery.ajax({
                            url: 'token_handler.ashx',
                            type: 'POST',
                            data: "accessToken=" + accessToken,
                            success: function (msg) {
    
                            }
                        });
    
                    } else if (response.status.indexOf('not_authorized') != -1) {
                        // the user is logged in to Facebook, 
                        // but has not authenticated your app
                    } else {
                        // the user isn't logged in to Facebook.
                    }
                });
            };
        (function (d) {
            var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
            if (d.getElementById(id)) { return; }
            js = d.createElement('script'); js.id = id; js.async = true;
            js.src = "//connect.facebook.net/en_US/all.js";
            ref.parentNode.insertBefore(js, ref);
        } (document));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying to find a solution but did not succeed even if it
I am trying to create an object of Console class, but could not succeed.
i been trying to code an IRC bot, while i have succeed. I am
I succeed installing Box2D into my project. But how can I render a body?
I'm using Python's unittest library and all the tests succeed, but I still get
i try to solve a problem but didnt succeed. I retrieve datas from google
I have Facebook app in my site. When we integrate Facebook, it will leads
I used facebook-sdk to integrate facebook in my android app and now I've succeded
I've integrated facebook in my android application using facebook sdk and succeded to do
I succeed to include ojdbc14_g.jar to my project, but I am asked to import

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.