Click here to Skip to main content
15,922,894 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have string in javascript file, now i want to convert it in text file and want to download it,

i have used following code,

function createFile(){
var object = new ActiveXObject("Scripting.FileSystemObject");
var file = object.CreateTextFile("C:\\Hello.txt", false);
file.WriteLine('Hello World');
file.WriteLine('Hope is a thing with feathers, that perches on the soul.');
file.Close();
}

and also this,


function WriteToFile()
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.CreateTextFile("C:\\Test.txt", true);
s.WriteLine('Hello');
s.Close();
}


and also tried downloadify js,
but its not working, is there any other method?
Posted
Comments
Herman<T>.Instance 16-Feb-12 6:27am    
it is very possible that ActiveXObject is not allowed to write a file on the root of you c:-drive.

1 solution

got,

ActiveXObject allows file to write,
but it is not supported in Firefox,
only supported in IE.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900