Facebook API Infinite Loop and No Cookie for IE and Chrome
I am trying to use the facebook connect on a website but I have some trouble on IE and Chrome.
Basically I used this method : https://developers.facebook.com/blog/post/534/ using JDK for the button and Php SDK for some call etc...

And Here is My code:

    include_once "src/facebook.php";
 

    $facebook = new Facebook(array(
	'appId'		=> $app_id,
	'secret'	=> $app_secret,
	));
    $user = $facebook->getUser();
    $user_profile = null;
    if ($user) {
         $logoutUrl = $facebook->getLogoutUrl();
  

       try {
          // Proceed knowing you have a logged in user who's authenticated.
             $user_profile = $facebook->api('/me');
  

          } catch (FacebookApiException $e) {
              $user = null;
            }
    }
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>TestFB</title>
        <link rel="stylesheet" href="site.css" type="text/css" media="screen" />
    </head>
    <body>
    <div id="fb-root"></div>
    <script>
      // Load the SDK Asynchronously
      (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));

      // Init the SDK upon load
      window.fbAsyncInit = function() {
            FB.init({
                appId      : <?php echo $app_id; ?>, // App ID
                status     : true, // check login status
                cookie     : true, // enable cookies to allow the server to access the session
                xfbml      : true,  // parse XFBML
                oauth      : true
            });

        // listen for and handle auth.statusChange events
            FB.Event.subscribe('auth.login', function(response) {
                window.location.href = './index.php';
            });
            FB.Event.subscribe('auth.logout', function(response) {
                window.location.href = './index.php';
            });
      }
    </script>
 

     <div class="logout" >
             <?php if ($user_profile)
                   {
                        echo '<a href="'.$logoutUrl.'"><h5>Logout</h5></a>';
                   }
                   else { ?>
                        <fb:login-button></fb:login-button>
             <?php } ?> 
    </div>

Everything is fine on Opera and Firefox, However I have an infinite loop on Chrome and IE. I searched for it, and I can actually fixed it by adding a setTimeout to the FB.event.subscribe.

However $facebook->getUser() is always = 0 and in the end I have the login button instead of logout url. (Even with the infinite loop)

Both problems happens only on IE and Chrome...

Somebody has a solution?
Facebook API Infinite Loop and No Cookie for IE and Chrome
===

I am trying to use the facebook connect on a website but I have some trouble on IE and Chrome.
Basically I used this method : https://developers.facebook.com/blog/post/534/ using JDK for the button and Php SDK for some call etc...

And Here is My code:

    include_once "src/facebook.php";
 

    $facebook = new Facebook(array(
	'appId'		=> $app_id,
	'secret'	=> $app_secret,
	));
    $user = $facebook->getUser();
    $user_profile = null;
    if ($user) {
         $logoutUrl = $facebook->getLogoutUrl();
  

       try {
          // Proceed knowing you have a logged in user who's authenticated.
             $user_profile = $facebook->api('/me');
  

          } catch (FacebookApiException $e) {
              $user = null;
            }
    }
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>TestFB</title>
        <link rel="stylesheet" href="site.css" type="text/css" media="screen" />
    </head>
    <body>
    <div id="fb-root"></div>
    <script>
      // Load the SDK Asynchronously
      (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));

      // Init the SDK upon load
      window.fbAsyncInit = function() {
            FB.init({
                appId      : <?php echo $app_id; ?>, // App ID
                status     : true, // check login status
                cookie     : true, // enable cookies to allow the server to access the session
                xfbml      : true,  // parse XFBML
                oauth      : true
            });

        // listen for and handle auth.statusChange events
            FB.Event.subscribe('auth.login', function(response) {
                window.location.href = './index.php';
            });
            FB.Event.subscribe('auth.logout', function(response) {
                window.location.href = './index.php';
            });
      }
    </script>
 

     <div class="logout" >
             <?php if ($user_profile)
                   {
                        echo '<a href="'.$logoutUrl.'"><h5>Logout</h5></a>';
                   }
                   else { ?>
                        <fb:login-button></fb:login-button>
             <?php } ?> 
    </div>

Everything is fine on Opera and Firefox, However I have an infinite loop on Chrome and IE. I searched for it, and I can actually fixed it by adding a setTimeout to the FB.event.subscribe.

However $facebook->getUser() is always = 0 and in the end I have the login button instead of logout url. (Even with the infinite loop)

Both problems happens only on IE and Chrome...

Somebody has a solution?