Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: execCommand("saveAs")


Message #1 by "xyz" <raok@h...> on Thu, 26 Sep 2002 14:19:16 +0300
Yes. But this is the only way to do it. 
The execCommand interacts with the IE browser and is only able to save the 
text file which is currently displayed in the browser window. 

An other possibility is to open a document in a new window. 
But when I tested it, there were some output errors (@ IE 5.0). 

dataString = "Data to save";

dataWin = window.open("about:blank","dataWin");
dataWin.document.open();
dataWin.document.write(dataString);
dataWin.document.execCommand("saveAs",true,"data.txt");
dataWin.document.close();
dataWin.close();

Then I tried this: 

dataWin = window.open("about:" + dataString,"dataWin");

...but the errors were still there. 

  Return to Index