Download file without extension with JavaScript
<p>I wanna download some files through js. </p>

<p>The following code works fine when the file has an extension <em>ie. <a href="http://example.com/img.jpg" rel="nofollow">http://example.com/img.jpg</a></em>, but when it doesn't <em>ie. <a href="http://example.com/img" rel="nofollow">http://example.com/img</a></em> it just redirects me to a blank page with the file, as a normal link does.</p>

<pre><code>function downloadURI(uri) {
  var link = document.createElement('a');
  link.href = uri;
  link.click();
}
</code></pre>

<p>How do I get over this issue, and make the browser to download?</p>