Possible Duplicate:
How to read and write into file using JavaScript
Is there any way to read from and write to a file (.txt or any other) using javascript .
For the clarification I do not want to use JQuery libraries .
Possible Duplicate:
How to read and write into file using JavaScript
Is there any way to read from and write to a file (.txt or any other) using javascript .
For the clarification I do not want to use JQuery libraries .
JavaScript executes in a sandbox to protect the computer from manipulation by evil people, so you cannot access the file system.
You can however store things in DOM Local Storage. "Flash Cookies" (Flash Local Storage Objects) are also frequently used for a similar purpose.
No, not with unprivileged JavaScript. Any JavaScript that loads in a Web browser via HTTP or HTTPS does not have the permissions to access the file system. This could have severe repercussions on a person's personal data security.
However, JavaScript with Chrome permissions, such as JavaScript loaded via a chrome://
URL in a Firefox extension, Thunderbird extension, or a XULRunner application is what is known as priviledged JavaScript. This type of JavaScript can do things that ordinarily wouldn't be possible with JavaScript served on the Web. For instance, priviledged JavaScript can read and write to files, among other things.
The primary factor that gives chrome-based JavaScript, or privileged JavaScript, the ability to do so much more is that user's must explicitly install it on their computer and allow it to access the local computer.
Lastly, there is server-side JavaScript, such as Rhino or NodeJS, which are designed to run on the server. While they cannot read/write to a client side user's file system, they of course can read and write to the server's file system.
It is not possible. Browser javascript doesn't have access to the filesystem. Otherwise it would be a huge security breach.
Use node.js http://nodejs.org/docs/v0.4.8/api/fs.html#file_System Or HTML 5 http://www.html5rocks.com/en/tutorials/file/dndfiles/ (for reading files)