Is it possible to read/write variables to an .ini file in java-script and save it to a common directory such as the desktop. PLEASE avoid examples with php because my html will be running natively in the browser, and I would like to have access to the .ini files created.
Asked
Active
Viewed 3,356 times
-3
-
1I don't think that's possible. [See here](http://stackoverflow.com/questions/3665115/create-a-file-in-memory-for-user-to-download-not-through-server). – Joseph Silber Nov 19 '12 at 00:51
-
Not in the client, but yes on the server with NodeJS: https://github.com/shockie/node-iniparser – elclanrs Nov 19 '12 at 00:53
-
@elclanrs - does that code run in a browser (which is what the question is directed at)? – jfriend00 Nov 19 '12 at 00:54
-
@jfriend00: Well no, but the actual parser is very small, so with a bit of work it could parse ini files on the browser from a `get` ajax request for example, or a simple string. – elclanrs Nov 19 '12 at 00:57
-
@elclanrs - I was under the impression that the OP wants to store per-user state locally on the client machine. They don't describe the real problem they're trying to solve (a common issue here on SO) so it's hard to know what they're really trying to do. – jfriend00 Nov 19 '12 at 01:01
-
@jfriend00: Yup, that too. Question in _not_ clear, I just read "ini", searched for "parse ini js" and copy/pasted the link. I'm lazy. – elclanrs Nov 19 '12 at 01:03
1 Answers
2
You can't write to a file on the desktop from a browser with Javascript for security reasons.
You can save similar state that one would put in a .ini file to either a cookie or to HTML5 Local Storage and then retrieve that info from future web pages.
If you describe the problem you're actually trying to solve, we could better advise what options are available.

jfriend00
- 683,504
- 96
- 985
- 979