how do I generate an xml file and allow the user to save it locally using javascript? -


I am creating an XMl document via JavaScript and to indicate the user to save it to my local machine the wanted.

This is the code I currently have at:

  var xmlWindow = window.open ("", ""); XmlWindow.document.write ("& lt; node & gt; data & lt; / node & gt;");  

It writes XML in a new window that can save users to download-> download.

  1. Is there a more streamlined way to do this?
  2. Is there a way to set the mime type of a new window so that XML is displayed properly?
  3. Is there a way to specify the title, when the user saves the hit, is the file name set correctly?

Note: Most Brokers (IE 6, IE 7, FF, Chrome).

You can send XML on a server via XMLHttpRequest to a script, then your XML file Set the new xml file window instead. Set the location. They will be motivated to save it.


Comments