i need to create a temp file to store user settings on the client side .it it possible to create a simple log file by JavaScript ?
If you want to store user settings, you should:
- use cookies
- store client information on the server
The ability for a webpage to access an individual's hard disk would be hazardous. However, as Trey pointed out below, you can use:
- HTML 5 Client Side Storage (browser support still limited)
- ActiveX/FileSystemObject (Windows/IE only)
You have a few options:
- Cookies
- localStorage
- database
Check this link:
Creating a file is possible only in IE using ActiveX objects.
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
Storing the data in cookies would be the perfect solution.
It's light, and almost any browser has cookies enabled by default.
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.