How to write a server response in a file?
<p>I am getting a server response like as below and I want to create an html file using javascript and save it on the local machine.</p>

<p>HTML File</p>

<pre><code>  &lt;!DOCTYPE html&gt;
    &lt;html&gt;
    &lt;head&gt;
     &lt;script&gt;
    function copyText()
    {
    }
    &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;

    Field1: &lt;input type="text" id="field1" value="Hey There"&gt;&lt;br&gt;
    Field2: &lt;input type="text" id="field2"&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;button onclick="copyText()"&gt;Copy Text&lt;/button&gt; 

    &lt;p&gt;A function is triggered when the button is clicked. The function copies the text from Field1 into Field2.&lt;/p&gt;

    &lt;/body&gt;
    &lt;/html&gt; 
</code></pre>

<p>Is it possible to create a file using javascript? </p>

<p>I tried to use </p>

<pre><code> fso = new ActiveXObject("Scripting.FileSystemObject");
                                            thefile=fso.CreateTextFile("C:\\tmp\\MyFile.txt",true);
write(responseHtmlStr)
</code></pre>

<p>on chrome but I got the error 'Uncaught ReferenceError: ActiveXObject is not defined '</p>

<p>I read somewhere that it is not possible due to security threat. Please give some pointers. It would be very helpful.</p>

<p>Thank you
Gendaful</p>
