title: Text file download in Visualforce page
body: <p>I have a download button in my visualforce page, on clicking which a text file(.txt format) has to be downloaded. This text file will be created dynamically with the data stored in a Text field of a custom object. Now I am struggling to acheive this simple download functionality without creating Attachments or Document Objects. Is there any possible way to download content as plain text file? Could some one please help me with this?</p>
  
  <p>I have tried the below visualforce code, but it is not downloading any files.</p>
  
  <pre><code>&lt;a href="data:text/plain;charset=utf-8;base64,{!getEncodedData}"&gt; Download License &lt;/a&gt;&lt;/apex:outputLabel&gt;
  </code></pre>
  
  <p>where getEncodedData will be the text file body.</p>
  
  <p>Apex code:</p>
  
  <pre><code>getEncodedData = EncodingUtil.base64Encode(Blob.valueOf(strContent));
  </code></pre>
  
  <p>P.N : I am trying to achieve this without creating Attachments, simply because the created file will not be reused later.</p>
  
  <p>Any help is really appreciated..!!</p>