title: Why does the Facebook JavaScript SDK request all these files?
body: <p>I'm trying to optimise the use of the Facebook SDK. Looking at Chrome's network tab shows me that when the SDK loads, it pulls in numerous other files:</p>
  
  <p><img src="https://i.stack.imgur.com/4ectg.png" alt="enter image description here"></p>
  
  <p>The first one is <em>all.js</em>, which contains the Facebook API. The rest of the resources in the screenshot are loaded after the call to <code>FB.init</code>.</p>
  
  <p>There are 3 calls to <em>about:blank</em>, and 3 calls to <em>xd_arbiter.php</em>. There are 2 calls to <em>oauth</em>. I can't work out why there are 3 calls to the first two.</p>
  
  <p>It appears that <em>all.js</em> creates 2 <code>iframe</code> elements (if the page that loads the SDK is served over HTTPS, only one is created - the <code>fb_xdm_frame_https</code> one. In this situation, it seems that 2 requests are made instead of 3):</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div id="fb-root" class=" fb_reset"&gt;
      &lt;div style="position: absolute; top: -10000px; height: 0px; width: 0px; "&gt;
          &lt;div&gt;&lt;/div&gt;
          &lt;div&gt;
              &lt;iframe id="fb_xdm_frame_http" name="fb_xdm_frame_http"&gt;&lt;/iframe&gt;
              &lt;iframe id="fb_xdm_frame_https" name="fb_xdm_frame_https"&gt;&lt;/iframe&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Blank pages are requested because the <code>iframe</code> elements are created with no <code>src</code> attribute (it's added later via JavaScript). When it gets set, it gets set to <em>xd_arbiter.php</em>.</p>
  
  <p>So that explains 2 of the 3. But where do the other calls to <em>about:blank</em> and <em>xd_arbiter.php</em> come from? I've got this far by running <em>all.js</em> through <a href="http://jsbeautifier.org/" rel="nofollow noreferrer">JSBeautifier</a> and following the code, but I can't see why or how those files are requested a third time.</p>