without_soul666
New Member
I am creating an XML string using JQuery. I would like to open a new window to display this string to the user in order he saves it as an XML file.I do not have a server side and I would like this Javascript script to be compatible with either Firefox and Internet Explorer browsers.I found a lot of stuff but nothing works really well.\[code\]uriContent="data:application/xml," + encodeURIComponent(xmlContent);var newWindow=window.open(uriContent,'_blank','toolbar=0,location=0,directories=0,status=0, scrollbars=1, resizable=1, copyhistory=1, menuBar=1, width=640,height=480, left=50, top=50');\[/code\]or for IE:\[code\]var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");xmlDoc.async = "false";xmlDoc.loadXML(xmlContent);var newWindow = window.open('','_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=1, menuBar=1, width=640, height=480, left=50, top=50', true); newWindow.document.writeln(xmlDoc.documentElement.xml); newWindow.document.close();\[/code\]The first solution works almost fine for Firefox but not for IE:
The second source code opens a window with the XML content but IE does not recognize it as XML... So the user has to display the source code by himself. This is not very convenient.
Does anyone have a solution?Thanks!