[Javascript] Using FileSystemObject when on-line

Per Hermansson phermansson at home.se
Tue Jun 18 11:30:39 CDT 2002


I agree with Peter, but you could try and add the remote site
to a trusted zone in IE, and set the security for that zone to
very low settings (I don't know which settings affect this behavior).

If that fails, you have to use something besides javascript.
(Active X control ? I have an ActiveX control that is run on
  a trusted site, and it can access the local printer, so file
  system might be ok too ? )

But that requires IE afaik, but you seem to have that as a pre-req.
anyway.

/Per H.

At 18:30 2002-06-18, you wrote:

>         Actually, I believe that's the point; you can't access the file 
> system with
>javascript from a remote web page, because it would be a huge security risk.
>
>-Peter
>
>|-----Original Message-----
>|From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
>|Behalf Of Rodney Myers
>|
>|The page below works in IE6.0 in file mode but the same page, when
>|loaded from an on-line location, fails with the error :
>|
>|Line 5:
>|Automation server can't create object.
>|
>|The page is closely based on an example in Pure Javascript by Wyke et
>|al.
>|The object of the exercise is to prove that a local file can be written
>|to hard disk from a file originating on a website.
>|
>|The development that will result from this will be a site restricted in
>|access to a group of company representatives. (i.e. It is most
>|definitely NOT for public use.)
>|
>|Is there something I have to add?
>|
>|tia
>|
>|Rodney
>|
>|
>|<html><head>
>|<title>Write to testfso_02</title>
>|<script type="text/jscript" language="JScript">
>|<!--
>|// Create a FileSystemObject object.
>|var myFileSysObj = new ActiveXObject("Scripting.FileSystemObject");
>|
>|// Create a TextStream object.
>|var myTextStream = myFileSysObj.OpenTextFile("c:\\temp\\testfso_02.txt",
>|2, true);
>|
>|// Write the first string to the file.
>|myTextStream.Write("Hello, World!");
>|// Write a newline character to the file.
>|myTextStream.WriteBlankLines(1);
>|
>|// Write a second string to the file.
>|myTextStream.Write("Hello, World Again!");
>|
>|// Close the stream to the file.
>|myTextStream.Close();
>|//--end-->
>|</script>
>|</head>
>|<body>
>|<p>This should write to c:\temp\testfso_02.txt</p>
>|</body></html>
>|




More information about the Javascript mailing list