Reputation: 976
I would like to write the data results from a form to the csv (or excel). I want to save this results in the server serverless (without php, etc.).
I have found this code:
<html>
<head>
<script language="javascript">
function WriteToFile(passForm) {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fileLoc = "C:\\sample.csv";
var file = fso.CreateTextFile(fileLoc, true);
file.writeline(passForm.FirstName.value + ',' +
passForm.LastName.value);
file.Close();
alert('File created successfully at location: ' + fileLoc);
}
</script>
</head>
<body>
<p>create a csv file with following details -</p>
<form>
Type your first name: <input type="text" name="FirstName" size="20">
Type your last name: <input type="text" name="LastName" size="20">
<input type="button" value="submit" onclick="WriteToFile(this.form)">
</form>
</body>
</html>
</br></br></html>
But it does work only with IE.
How to solve this problem?
Regards
Upvotes: 1
Views: 5313
Reputation: 2121
as i understand your question and searched i found that
ActiveX is only supported by IE - the other browsers use a plugin architecture called NPAPI. However, there's a cross-browser plugin framework called Firebreath that you might find useful.
you can refer to this question
Upvotes: 1