title: Can I save only text via document.execCommand('Save As',...)? I'm always returned some HTML tags
body: <p>Using the code below I can save a data locally in IE9 with Javascript. However, the file includes HTML tags when all I want to save is the text. How can I only save the text without the tags? Thanks</p>
  
  <p>Code:</p>
  
  <pre><code>var doc = saveTxtWindow.document;
              doc.open('text/plain', 'replace');
              doc.charset = charset;
              if (fileName.endsWithAny('.htm', '.html')) {
                  doc.close();
                  doc.body.innerHTML = '\r\n' + textContent + '\r\n';
              } else {
                  if (!fileName.endsWithAny('.txt')) fileName += '.txt';
                  doc.write('mytext');
                  doc.close();
              }
  
          var retValue = doc.execCommand('SaveAs', null, fileName);
          saveTxtWindow.close();
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>&lt;! DOCTYPE HTML PUBLIC "-//w3c//DTD HTML 4.0 Transitional//EN"&gt;&lt;! DOCTYPE HTML&gt;&gt;&lt;HTML&gt;&lt;HEAD&gt;&lt;META content="text/html; charset=utf-8" http_equiv="Content-Type"&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;mytext&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;
  </code></pre>