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.
HTML File
<!DOCTYPE html>
<html>
<head>
<script>
function copyText()
{
}
</script>
</head>
<body>
Field1: <input type="text" id="field1" value="Hey There"><br>
Field2: <input type="text" id="field2">
<br><br>
<button onclick="copyText()">Copy Text</button>
<p>A function is triggered when the button is clicked. The function copies the text from Field1 into Field2.</p>
</body>
</html>
Is it possible to create a file using javascript?
I tried to use
fso = new ActiveXObject("Scripting.FileSystemObject");
thefile=fso.CreateTextFile("C:\\tmp\\MyFile.txt",true);
write(responseHtmlStr)
on chrome but I got the error 'Uncaught ReferenceError: ActiveXObject is not defined '
I read somewhere that it is not possible due to security threat. Please give some pointers. It would be very helpful.
Thank you Gendaful