2

I cannot to write data from IE to a local file. I have next problem: when I create html page with next content

<html>
<head>
<title>File's saving</title>
  <SCRIPT>
function cf_random() {
b="c:\\file.txt";

var fso, f1; 
fso = new ActiveXObject("Scripting.FileSystemObject");
f1 = fso.CreateTextFile(b, true);

f1.WriteLine("Testing") ;
document.writeln("File " + b + " is created.");
}
  </SCRIPT>


</head>
<BODY>
<input type=button value="Create file" onClick="cf_random()">
</body>
</html>

it works great, but when I try the same code with extern js file that I attach to site using bookmarklet - I get an error SCRIPT429: Automation server can't create object(code bellow)

javascript: (function() {
    var s2 = document.createElement('script');
    s2.src = 'http://192.168.0.100/jquery.js';
    document.body.appendChild(s2);
})();

$(document).ready(function(){    
b="c:\\file.txt";
var fso, f1; 
fso = new ActiveXObject("Scripting.FileSystemObject");
f1 = fso.CreateTextFile(b, true);
f1.WriteLine("Testing") ;
document.writeln("File " + b + " is created.");
});

What can be wrong?

3
  • I wouldn't recommend writing to a file on a client machine using scripts. Commented Oct 6, 2012 at 16:18
  • I try to explain. It's code I'll not be using on my site. It's code it's just for my local machine. I try to parse, with js code, web page that currently loaded in my browser(not my page, it's can be google page for example) and than write obteined results to extern file. So I need to write to the file. Commented Oct 6, 2012 at 16:23
  • Maybe this will help? stackoverflow.com/questions/10193532/… Commented Oct 6, 2012 at 17:02

1 Answer 1

1

I solved this problem. It's just secrity settings.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.