title: AngularJS $http.post error in Internet Explorer <= 9
body: <p>I have the following bit of code, which works fine in every modern browser, but fails in Internet Explorer 9 and below.</p>
  
  <pre><code>authService.login = function(credentials) {
    return $http.post('https://example.com/login', credentials).then(function(res) {
      return res;
    }, function(err) {
      return err;
    });
  };
  </code></pre>
  
  <p><code>credentials</code> is an object that looks like this:</p>
  
  <pre><code>{
    username: 'john@example.com',
    password: 'smith'
  }
  </code></pre>
  
  <p>The problem is that the POST never actually happens, instead it jumps straight to <code>return err;</code> and no error is even set. It says <code>Impossible d'effectuer l'opération à cause de l'erreur suivante c00c023e.</code>. The key being <strong>c00c023e</strong>, which is supposedly an encoding problem, but I don't see how that would completely prevent the call from happening.</p>
  
  <p>The 'fix' is to use <code>$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';</code> which does allow IE to POST, but my backend expects JSON so that doesn't help.</p>
  
  <p>I'm using AngularJS 1.2.22.</p>
  
  <p>Any ideas?</p>