title: datauris: are PNG and JPEG MIME types interchangable in modern browsers?
body: <p>I have noticed that if you take a base64 string representing the raw bytes of either a JPG or a PNG, call this <code>&lt;B&gt;</code>, and you send a datauri to the browser using <em>either</em>:</p>
  
  <pre><code>data:image/png;base64,&lt;B&gt;
  </code></pre>
  
  <p>or </p>
  
  <pre><code>data:image/jpeg;base64,&lt;B&gt;
  </code></pre>
  
  <p><em>all four</em> combinations work (by work I mean Chrome renders them), the four combinations being <code>&lt;B&gt;</code> is raw png image, or raw jpeg image, and the data uri uses either MIME type.</p>
  
  <p>Why is this? The binary encoding of jpeg and png are not the same. I was expecting that if <code>&lt;B&gt;</code> was the raw bytes of a png, the jpeg datauri would fail to render, and visa versa. </p>