By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,237 Members | 1,483 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,237 IT Pros & Developers. It's quick & easy.

can I write to a local .txt File wit javascribt?

P: n/a
javascript:
can I write to a local .txt File
as exaple:

open() ....writel(() ...close()..... ....save as ... c:\test.txt
thank you if you have an idea
Hansueli
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Thu, 20 Nov 2003 18:46:56 +0100, Rickli Hansueli wrote:
javascript:
can I write to a local .txt File
as exaple:

open() ....writel(() ...close()..... ....save as ... c:\test.txt thank
you if you have an idea
Hansueli


You shouldn't be able to from what I know.
That would violate the browser security.
--
i.m.
The USA Patriot Act is the most unpatriotic act in American history.

Jul 20 '05 #2

P: n/a
"Rickli Hansueli" <ri****@rickli.com> writes:
javascript:
can I write to a local .txt File


No, not in the standard browser security environment.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3

P: n/a
> can I write to a local .txt File

Perhaps you meant "JavaScript"? Yes, in the right runtime environment.
Here are two environments that can:

Sash: http://sash.alphaworks.ibm.com/
WSH:
http://msdn.microsoft.com/library/de...ScriptHost.asp

The webbrowser environment does not ordinarily permit this.

http://www.crockford.com/#javascript

Jul 20 '05 #4

P: n/a
"Rickli Hansueli" <ri****@rickli.com> wrote in message
news:3f**********@news.bluewin.ch...
javascript:
can I write to a local .txt File
as exaple:

open() ....writel(() ...close()..... ....save as ... c:\test.txt


In the standard web environment no, but on your local PC you can, e.g.

var fso = new ActiveXObject("Scripting.FileSystemObject");
var myfile = fso.CreateTextFile("c:\\myfile.txt", true);
myfile.WriteLine("Some test.");
myfile.Close();

Search Google for FileSystemObject for more information.

If you have some antivirus program, it may stop the script.

Vjekoslav
Jul 20 '05 #5

P: n/a
A previous post shows an IE only method, if you want to do the same
thing in Mozilla or Netscape 7 then have a look at this tip:

http://www.faqts.com/knowledge_base/...d/23360/fid/53



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.