title: Can I stop my HTML page from loading until after my Facebook login status script has run?
body: <p>I am using the Facebook Javascript SDK to enforce that users who access my site must be logged into Facebook. I'm using the function <em>StatusChangeCallback</em> to redirect visitors to a Facebook login page if they aren't logged into Facebook. I have copied a snippet of my script below, which is in the Head tag of my web page.</p>
  
  <p>This works fine, except that I notice that my page loads momentarily before the script redirects the visitors to a login page. That means that visitors can click the "Stop" button and bypass this redirect functionality.</p>
  
  <p><strong>Is there a way to prevent the page from loading until after my Facebook login script has completed?</strong></p>
  
  <pre><code>    &lt;script&gt;
    function statusChangeCallback(response) {
      console.log('statusChangeCallback');
      console.log(response);
      if (response.status === 'connected') {
        //Continue loading the page 
      } else if (response.status === 'not_authorized') {
        window.location.href = "facebook.html";
      } else {
        window.location.href = "facebook.html";
      }
    }
  </code></pre>