Can I write to file in JavaScript?

L

Laurent Bugnion

Hi,

Ivan said:
Which isn't javascript... so, therefore no, you can't.

Actually, with appropriate permissions, you can. I can publish the code
for Netscape 4.*, Mozilla (Netscape 6, 7, Firefox) and for IE if needed.

HTH,
Laurent
 
R

Randy Webb

Laurent Bugnion said the following on 6/16/2006 6:00 PM:
Hi,



Actually, with appropriate permissions, you can. I can publish the code
for Netscape 4.*, Mozilla (Netscape 6, 7, Firefox) and for IE if needed.

Does your code also document the pitfalls with trying to write to the
File System from an Internet page?
 
L

Laurent Bugnion

Hi,

Randy said:
Laurent Bugnion said the following on 6/16/2006 6:00 PM:



Does your code also document the pitfalls with trying to write to the
File System from an Internet page?

It's not a demo or a tutorial, only code that I use under certain
circumstances (i.e. I use it only in pages running in the file:
protocol). It just bugged me to read that JavaScript cannot write to
files, which is not correct.

HTH,
Laurent
 
A

Aaron Gray

Actually, with appropriate permissions, you can. I can publish the code
for Netscape 4.*, Mozilla (Netscape 6, 7, Firefox) and for IE if needed.

Okay I am interested in a copy. Can you send me a link ?

Aaron
 
R

Randy Webb

Laurent Bugnion said the following on 6/19/2006 7:15 AM:
Hi Randy,



I posted a demo on my website
http://www.galasoft-lb.ch/myjavascript/CExplorer

I'd be interested to hear what you think of it in order to improve the
description of it.

Even with a File>Save As and executing it locally IE6 throws an
automation error. I didn't look to find it yet, but I will try later.
Note: It's basically just a proof of concept.

The concept is solid, its implementation is what is difficult with the
state of security settings.

The problem isn't JS' lack of ability to save files locally, it is the
lack of privileges that prevents it from being reliable on an internet
website.
 
L

Laurent Bugnion

Hi,

Randy said:
Even with a File>Save As and executing it locally IE6 throws an
automation error. I didn't look to find it yet, but I will try later.

Try saving the demo zip file at
http://www.galasoft-lb.ch/myjavascript/CExplorer/cexplorer.demo.zip

I tested that on a few different PCs without errors.
The concept is solid, its implementation is what is difficult with the
state of security settings.

The problem isn't JS' lack of ability to save files locally, it is the
lack of privileges that prevents it from being reliable on an internet
website.

That's what I mean with "Many people assume that client-side JavaScript
cannot perform file-system operations on the client computer. Actually,
the objects needed are often found in the browsers, and the rest is only
a matter of compatibility (the way IE saves files is very different from
the way Firefox saves files...) and of permissions."

Maybe I should underline better the "permissions" thing.

Note also "I usually use these methods either in HTA applications
(running locally, granted extended privileges by IE), or in the "file:"
protocol. This is what they have been designed for."

Thanks for your feedback.

Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top