title: "Aw, Snap" when data uri is too large
body: <p>I'm writing a chrome extension which does the following:</p>
  
  <ol>
  <li>Downloads a file from a website to memory using <code>XMLHttpRequest</code></li>
  <li>Adds additional data to the file and then base64 encodes the result to the variable <code>total_encoded_data</code></li>
  <li>Offers the data to the user using <code>&lt;a href=data:application/octet-stream;charset=utf-8;base64,' + total_encoded_data+' download='file.bin'&gt;Click to Download&lt;/a&gt;</code>. Where <code>total_encoded_data</code> is added to href using jQuery.</li>
  </ol>
  
  <p>I have found, through a manual binary search, that if the size of <code>total_encoded_data</code> is greater than 2097100 characters, then I will get an Aw, Snap message when I click the link. If the size is smaller, then I can download as expected.  </p>
  
  <p>In addition to testing the filesize, I also used <code>atoi</code> to ensure that the base64 encoding is valid, and it operates without error.</p>
  
  <p>The Aw, Snap messages don't produce any crash reports in <code>chrome://crashes</code> nor any unexpected output in the <code>chrome_debug.log</code></p>
  
  <p>How do I avoid an Aw, Snap message when serving a data uri where the base64 encoded string length is greater than 2097100?</p>