Browsers such as Firefox do not support writing local files for security reasons.
IE can write XML files in the following ways
Mode one: FSO
Copy Code code as follows:
Loadxml () read 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 a text file
CreateTextFile (Filename,overwrite,unicode)
FileName: filename
Overwrite: If the file exists, overwrite it, and the default is False
Unicode: Whether the contents of the file are stored as Unicode text;
Mode two: SaveAs
Hide iframe in page embedding,
Copy Code code as follows:
<iframe name= "Export" src= "About:blank" style= "Display:none"; ></iframe>
Writes the XML content to the IFRAME and saves as a file.
Copy Code code as follows:
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
Hint does not have permission to browse IE Security policy settings, also did not find the right to modify the place
This method should not be done.