title: FB.Init Async with Facebook Developer Toolkit
body: <p>I have an existing asp.net web app that uses facebook to authenticate users. I am using this facebook toolkit  <a href="http://facebooktoolkit.codeplex.com/" rel="nofollow">http://facebooktoolkit.codeplex.com/</a></p>
  
  <p>My page has the following code:</p>
  
  <pre><code>&lt;script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"
      type="text/javascript"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      //Login and redirect
      function onLogin() {
          window.location.href = "facebookusermapping.aspx";
      }
  &lt;/script&gt;
  
  
     &lt;div class="FBLogin"&gt;&lt;fb:login-button onlogin="onLogin()"&gt;&lt;/fb:login-button&gt;&lt;/div&gt; 
  
  &lt;script type="text/javascript"&gt;FB.init("&lt;%=ConfigurationManager.AppSettings["ApiKey"]%&gt;","xd_receiver.htm");&lt;/script&gt;
  </code></pre>
  
  <p>My page is taking a while to load as it appears to be waiting for the facebook login button and things to load, so it has been suggested I do it asynchronously using this code:</p>
  
  <pre><code> &lt;div id="fb-root"&gt;&lt;/div&gt;
  &lt;script&gt;
    window.fbAsyncInit = function() {
      FB.init({
        appId  : 'YOUR APP ID',
        status : true, // check login status
        cookie : true, // enable cookies to allow the server to access the session
        xfbml  : true  // parse XFBML
      });
    };
  
    (function() {
      var e = document.createElement('script');
      e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
      e.async = true;
      document.getElementById('fb-root').appendChild(e);
    }());
  &lt;/script&gt;
  </code></pre>
  
  <p>but this is using the new Api where as the tool kit I think is using the old API?</p>
  
  <p>When I use my existing code to check if the user is authenticated it always comes back as false.</p>
  
  <p>Without having to re-write too much does anyone know of a way I can stop my page waiting for the facebook things to load? </p>