XML file download using Javascript Not working in IE -
am trying create xml file content , download it. wrote code this,
/* preparing xml data*/ var xml=new xmlwriter(); xml.beginnode("root node"); xml.attrib("adib", "attribute"); xml.node("fullname", "anil"); xml.node("d.o.b", "31/12/2015"); xml.endnode(); xml.close(); /* downloading xml file*/ var data = xml.tostring().replace(/</g,"\n<"); var = document.createelement('a'); a.href= 'data:application/xml;charset=utf-8,' + encodeuricomponent(data); a.target = '_blank'; a.download = 'new.xml'; a.click();
it working in chrome not in ie. can please me.
it's because of differences support of data urls in common browsers. can check compatibility here: http://caniuse.com/#feat=datauri . , far know, ie has limited (https://msdn.microsoft.com/en-us/library/cc848897(v=vs.85).aspx).
Comments
Post a Comment