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

  • Home
  • SEARCH
  • 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 8071887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:50:05+00:00 2026-06-05T13:50:05+00:00

This is my Facebook connect Code: <script> jQuery(document).ready(function($){ $(.fb-login-button).live(‘click’, function() { console.log(‘click’); fbEnsureInit(function() {

  • 0

This is my Facebook connect Code:

<script>
jQuery(document).ready(function($){
    $(".fb-login-button").live('click', function() {
      console.log('click');
      fbEnsureInit(function() {
        console.log('EnsureInit');
        FB.login(function(response) {
          console.log('FB.login');
          // redirect will be done
        }, {scope: 'email'});
      });
  });
});

window.fbAsyncInit = function() {
  FB.init({
    appId      : '105224616211361', // App ID
    /*channelUrl : '///channel.html', // Channel File // We don't do not to get caching problems with the laguage!*/
    status     : true, // check login status
    cookie     : true, // enable cookies to allow the server to access the session
    oauth      : true, // enable OAuth 2.0
    xfbml      : true  // parse XFBML
  });
  // Additional initialization code here
  fbApiInitialized = true;

  // whenever the user logs in, we refresh the page
  FB.Event.subscribe('auth.login', function(response) {
    try {
      if (response.status == 'connected') {
      console.log('connected');
      $.ajax({
        type: "POST",
        url: "/?eID=login&modus=facebook&fb-login=1",
        data: $(this).serialize(),
        success: function(msg) {
          console.log("LOGIN");
          window.location.reload();
        }
      })             
    } else {
      console.log('not connected');
      window.location.reload();
    }
  } catch(err) {
    window.location.reload();
   }
});
};

/**
 * Make sure that the FB is initialized!
 */
function fbEnsureInit(callback) {
  if (!window.fbApiInitialized) {
    setTimeout(function() { fbEnsureInit(callback); }, 50);
  } else {
    if (callback) { callback(); }
  }
}

/**
 * Load the JS SDK directly from Facebook
 */
(function() {
    var e = document.createElement('script'); e.async = true;
      e.src = document.location.protocol +
      '//connect.facebook.net/de_DE/all.js';
      document.getElementById('fb-root').appendChild(e);
    }());

</script>

The SDK gets loaded. I can see the FB- Button and when i click it the Code works until

console.log('FB.login');

The FB-Popup pops up and nothing happens… This should be the point where:

  FB.Event.subscribe('auth.login', function(response) {

should get called… but it doesn’t.. can anyone help me with this problem?

Thanks.

EDIT:

I just noticed that this only happens, when I am already logged in into Facebook. If I am not logged in, the Login Popup pops up twice(!) and I can login to Facebook and the function FB.Event.Subscribe gets called.

So how can I see if the user is logged in to Facebook and is connected to my application?

And why is the Popup called twice?

  • 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-05T13:50:07+00:00Added an answer on June 5, 2026 at 1:50 pm

    You need to use FB.getLoginStatus if you want to check whether the user is connected to your application.

    The login popup is fired twice because the FB-button has a login function too. Remove your ajax call to $(".fb-login-button").live and modify your login button like this:

    <div class="fb-login-button" scope="email" data-show-faces="true" data-width="200" data-max-rows="1"></div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this Facebook Login Button code: <div id=fb-root></div> <script src=http://connect.facebook.net/en_US/all.js></script> <script> FB.init({ appId
This is the code for the Facebook like button: <div id=fb-root></div> <script>(function(d, s, id)
I have this code in a .html.erb file: <script src=http://connect.facebook.net/en_US/all.js#xfbml=1></script> <script> FB.Event.subscribe('edge.create', function(response) {
i have copied this code from the FB.init documentation : <script src=http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US type=text/javascript></script> ...
I have this code to log people in with Facebook: <div id=fb-root></div><script src=http://connect.facebook.net/en_US/all.js#appId=my_app_id&amp;xfbml=1> </script><fb:login-button
when i'm looking at the html source, i look this javascript code <script src=http://connect.facebook.net/en_US/all.js#xfbml=1></script>
So I'm using this code: <iframe src=http://www.connect.facebook.com/widgets/fan.php?href=http://www.facebook.com/pages/TopDesenecom/148037301911330&width=205&height=256&show_faces=true&stream=false&header=false&css=http://topdesene.com/template/fb.css></iframe> and facebook shows this code: <link href=http://external.ak.fbcdn.net/fbml_static_get.php?src=http%3A%2F%2Ftopdesene.com%2Ftemplate%2Ffb.css&appid=148037301911330&pv=1&sig=59bf9a037df3a88cb6ff142f25227177&filetype=css&cb=2
The code is easy : <script src=http://connect.facebook.net/en_US/all.js#xfbml=1 type=text/javascript></script> <fb:like href=http://www.google.com send=false layout=button_count width=auto show_faces=true
I am using fb connect using js. This is my code: <script> window.fbAsyncInit =
I am using the following code to rendered the facebook login button <div id=facebook-login>

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.