title: Is it possible to initiate a download prompt in the browser for recognized MIME types using only JavaScript (client-side approach)?
body: <p>I would like to allow the user to directly download a file with a single click. There is however a problem when it comes to known MIME types like HTML, audio, video, etc. Ideally, I would like to trigger a download prompt for audio/video files. Ultimately, I would like to do it for HTML documents too. The main idea is to make it easy for users to download files without asking them to navigate into the context menu.</p>
  <p>I think for example to people that are not really comfortable with a computer and its main functions. These people will surely prefer a better way than &quot;save as&quot;.</p>
  <p>The reason why I am looking for a JavaScript solution is that the PHP approach only works if you are in a web site context. Whenever you are inside a plugin or injected script context (i.e. developing a plugin for Firefox, Chrome or Safari), you may want to avoid asking for a server-side response.</p>
  <p>I tried to achieve this with <code>window.open()</code> and  <code>document.execCommand(&quot;saveAs&quot;,...</code>. It does work, although it is glitchy and fails for huge files.</p>
  <p>Then, I tried <a href="https://github.com/dcneiner/Downloadify" rel="nofollow noreferrer">Downloadify</a> which does not work in every situations.</p>
  <p>Is there a pure JavaScript, no Ajax way to trigger a download prompt so the user can directly download a file using a simple left click?</p>