title: navigator.sendBeacon with application/x-www-form-urlencoded
body: <p>I'm trying to send a <code>POST</code> request on the <code>beforeunload</code> event using <code>navigator.sendBeacon</code>, but the data doesn't get to the PHP <code>$_POST</code>. I think this is because when using <code>navigator.sendBeacon</code> the header <code>Content-Type</code> is always set to <code>text/plain;charset=UTF-8</code>, but in my case since I need to send a query string and therefore use <code>application/x-www-form-urlencoded</code>.</p>
  
  <pre><code>var amountOfApples = 0;
  
  ...
  
  addEventListener("beforeunload", function(e) {
      navigator.sendBeacon("save.php", "key=apples&amp;value=" + amountOfApples);
  });
  </code></pre>
  
  <p>How can I do this and make sure the header is set to <code>application/x-www-form-urlencoded</code>?</p>