For security reasons, browsers such as Firefox do not support writing local files.
You can write xml files in the following ways under IE
Method 1: fso
// LoadXML() See the previous article for reading XML under IE
var xmlDom = loadXML("config.xml");
var contentText = "";
if(typeof xmlDom.xml != 'undefined') {
contentText = xmlDom.xml;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var file = fso.CreateTextFile ("D:\test\test.xml", true);
file.Write(contentText);
file.Close();
Create text file
CreateTextFile (filename, overwrite, unicode)
filename: file name
overwrite: if the file exists, whether to overwrite it; the default is false
unicode: whether the content of the file is stored as unicode text; the default is false
Method 2: saveAs
embed a hidden iframe in the page,
Write xml content into iframe , save as file.
var frame = window.frames["export"];
frame.document.open();
frame.document.write(contentText);
frame.document.execCommand("saveAs",true,"test.xml");
frame. document.close();
In addition, IE XMLDOM has a save method
prompting that there is no permission. I browsed the security policy settings of IE and found no place where permissions can be modified
The method should not be feasible.