title: Creating download prompt using purely javascript
body: <p>I have some text data (say <code>var a = 'Hello World From Javascript';</code>)in javascript variable in current window. I want to do the following
  through javascript-</p>
  
  <pre><code>1. open a new window and write the text data to the window.
  2. set the content type to text/plain.
  3. set the content-disposition to attachment, so that download prompt comes.
  4. user downloads the text data as a text file and saves it to his local disk.
  </code></pre>
  
  <p>is this all possible through javascript?</p>
  
  <p>I know we can make ajax calls to server or redirect but in this case instead of following above steps. But in this case, these workarounds are not adaptable.</p>