title: Facebook JS SDK with Windows 8 - FB is undefined
body: <p>I'm creating an app for windows 8 that involves facebook integration. I know you can't load in external javascript so I stuck an iframe as the very first element which linked to a file that linked to the facebook sdk. My DOM explorer seems to tell me that that loads fine</p>
  
  <p>Despite having a </p>
  
  <pre><code>$(document).ready(function() {
  }
  </code></pre>
  
  <p>around my FB.login function (which is below <code>window.fbAsyncInit</code>), I'm being told that 'FB' is undefined.</p>
  
  <p>Some notes:
  - Login is only invoked after the user presses a button
  - Works fine online
  - My JS code..</p>
  
  <pre><code>window.fbAsyncInit = function() {
   FB.init({
      appId      : 'APP ID', // App ID
      channelUrl : '//url', // Channel File
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      frictionlessRequests : true, // enable frictionless requests        
      xfbml      : true  // parse XFBML
   });
  
   FB.getLoginStatus(function(response) {
      ...
   }); 
  }; 
  
  
  function goLogIn() {
    $(document).ready(function () {
      FB.login(function(response) {
        ...
      }, {scope: 'user_photos,friends_photos,publish_stream',}); //FB.login
    });
  }
  </code></pre>
  
  <p>Any ideas on why this is doing this? I'm presuming its to do with the order windows 8 processes things in..</p>
  
  <p>Thanks,
  Niall</p>