Alon M
Alon M

Reputation: 1683

Create and Write to Files with JavaScript/JQuery

A few days ago I started to build a "Talk To Us Page" In c#.

So, I did a few buttons and text arena options..

And it was easy as C# should be. You just use a system IO or any thing and write to files..

I tried to do some thing very similarly with JS\jQuery and had no idea how to do so.

I looked around google a bit, and found nothing. Really, found about 30 people who are saying things that are really not working.

And I have to do is write a few lines of text from textbox..

The textboxes look like this:

<input type="text" name="">

<input type="text" name="">

and when you clicked of a button it will write it all down to a file in driver c, or anything like that.

I really thinks its not that hard, but I need a hand.

Please help me. thanks!

Upvotes: 0

Views: 317

Answers (3)

Rafay
Rafay

Reputation: 31043

javascript cant access the files contents, atleat on the client machine.

here is a helpful link http://en.wikipedia.org/wiki/JavaScript#Security

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1039498

and when you clicked of a button it will write it all down to a file in driver c, or anything like that.

Forget about it. For security reasons javascript that runs in a browser has no access to client and server files. Just think of the consequences if this was possible. You visit some site on the internet and all of a sudden files start to popup up and out of existence from your hard drive. Definitely something that should be forbidden.

Upvotes: 3

Matt Ball
Matt Ball

Reputation: 360026

Outside of Internet Explorer, you cannot use JavaScript to write to the local file system. This is a security feature of the sandbox in which in-browser JS runs.

Upvotes: 0

Related Questions