How can I write text files on c:? I can create files on d: but why not on the other? Maybe there's some restriction on that.
Here's my code
openTxt.html
<html><head>
<script language="javascript">
function WriteToFile()
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var FileObject = fso.OpenTextFile("C:\\LogFile.txt", 8, true,0); // 8=append, true=create if not exist, 0 = ASCII
FileObject.write("hey!")
FileObject.close()
}
</script>
</head>
<body onLoad="WriteToFile()">
</body>
</html>
In general it is bad practice to access the client Operating System with javascript, and in many cases it is near impossible with some exceptions (like using an ActiveX control).
Typically if you want to write a log file, that is more for server side coding. If you have a server-side platform behind this page, I would use a web service to handle your logging.
Why write logs on the client machine?