I need to create a temporary file to store user settings on the client side. Is it possible to create a simple log file using JavaScript?
If you can live with the user having to actively store the file, Downloadify allows you to generate a client side "download" on the fly.
You can't create file on fly to the client side as there are Security restrictions
but i found a nice article on file by JavaScript have a look http://www.nczonline.net/blog/2012/05/31/working-with-files-in-javascript-part-4-object-urls/
Try this anyway
var fso = new ActiveXObject("Scripting.FileSystemObject");
varFileObject = fso.OpenTextFile("C:\\Sachin.txt", 2, true,0); // 2=overwrite, true=create if not exist, 0 = ASCII
varFileObject.write("File handling in Javascript");
varFileObject.close();
http://www.codeproject.com/KB/scripting/JavaScript__File_Handling.aspx
But i dont think you have to do this type of experiments. You can create and do many file manipulations using server side languages.Thats better
If you want to store user settings, you should:
The ability for a webpage to access an individual's hard disk would be hazardous. However, as Trey pointed out below, you can use:
You cannot! This violates browser security protocols.
All client-side code in a browser (HTML/CSS/Java-Script) is supposed to get executed inside a security sandbox. As soon as you close the browser session, this sandbox is destroyed. This sandbox protects your local filesystem from malicious attacks.
Ideally, if you were able to do this, then, by just browsing through several links, those sites should be able to write viruses on your system as you do so!!
You have a few options:
Check this link:
Creating a file is possible only in IE using ActiveX objects.