title: How to catch a 403 forbidden error in JS?
body: <p>I am trying to hack a little this facebook javascript code to make a call on an other js if the GET failed.</p>
  
  <p>I have something like this :</p>
  
  <pre><code>&lt;div id="fb-root"&gt;&lt;/div&gt;
  &lt;script&gt;(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/yi_YI/all.js#xfbml=1&amp;appId=###";
    fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));&lt;/script&gt;
  &lt;div class="fb-comments" data-href="###" data-num-posts="10" data-width="646"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Which give a 403 Forbidden (<code>/*  Not a valid locale.  */</code>). When it does something like this, I want to be able to load the en_US facebook sdk. So, I have tried :</p>
  
  <pre><code>&lt;div id="fb-root"&gt;&lt;/div&gt;
  &lt;script&gt;(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/yi_YI/all.js#xfbml=1&amp;appId=###";
    try { fjs.parentNode.insertBefore(js, fjs); }
    catch(err) {
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&amp;appId=###";
        fjs.parentNode.insertBefore(js, fjs);
    }
  }(document, 'script', 'facebook-jssdk'));&lt;/script&gt;
  &lt;div class="fb-comments" data-href="###" data-num-posts="10" data-width="646"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>But, it doesn't work, keep getting 403 Forbidden, like if the <code>try</code> and <code>catch(err)</code> is not working. </p>