title: how to add mime type to data url
body: <p>How can I add mime type to data url, for example </p>
  
  <blockquote>
    <p>Ex: <code>data:image/jpeg,http://google.com/images/abc.jpg</code></p>
  </blockquote>
  
  <p>In fact I have the images url to which I am appending <code>data:image/jpeg</code> otherwise  am only able to download the image as abc.txt (server defaulting to text) on anchor/link click using download attribute. </p>
  
  <p>I have no access to server's <code>Content-Disposition</code> headers and the images url is hosted internally so heroku cors proxy is unable to access the images file server.</p>
  
  <p>When I add data:image/jpeg to url, I am able to download the file with my own name but there is no content on the file, if i do not use any <code>data:</code> stuff I am able to get the file correctly but filename is different from what is mentioned in the download attribute.</p>
  
  <p>I therefore want to know how to correctly set url so I can download the file with my own name accordingly.</p>
  
  <p><strong>EDIT:</strong>
  Adding relevant Javascript I use to download file</p>
  
  <pre><code>var link = document.createElement("a");
  link.download = file_name;
  link.target="_blank";
  link.href = url;
  document.body.appendChild(link);
  link.click();
  document.body.removeChild(link);
  delete link;
  </code></pre>
  
  <p>The google image url is just an example but it actually is a local file server, the filename can be any name I specify.</p>