Usually when we go through the href link file, the general situation is for the zip, jar and other download functions, and for XML, CSS, HTML, JS and so is the view function.
The following code can now generate a string in XML format to generate an XML file so that the XML file can be downloaded.
<! DOCTYPE html>"en">"UTF-8"> <title>Title</title>window.onload=function () {varHTML ='<a href= "Data:text/xml;charset=utf-8,'+ encodeURIComponent (text) +'"download=" > Downloads </a>'; Document.body.innerHTML=html; } varText ='<?xml version= "1.0" encoding= "UTF-8" standalone= "yes"? >\<config-routing> <array name="Private"> <key name="Amount">3</key> <array name="Info"> <key name="name"> Aston </key> <key name="ID">1</key> </array> <array name="Info"> <key name="name"> Aston </key> <key name="ecu_id">2</key> </array> <array name="Info"> <key name="name">3we</key> <key name="ID">3</key> </array> </array> </config_routing>';</script>This will not have to pass data to the background, and then the background to assemble XML, and then to download XML, more efficient.
The foreground implements the download XML function