I got a requirement as following:
There is a link on a web page. As user clicks on link it should create a file on the fly and a download box pops up. How to do it u
You can use blobs as shown in this example http://html5-demos.appspot.com/static/a.download.html
You can have a javacript function with the following code
var xmltext = " ";
var pom = document.createElement('a');
var filename = "file.xml";
var pom = document.createElement('a');
var bb = new Blob([xmltext], {type: 'text/plain'});
pom.setAttribute('href', window.URL.createObjectURL(bb));
pom.setAttribute('download', filename);
pom.dataset.downloadurl = ['text/plain', pom.download, pom.href].join(':');
pom.draggable = true;
pom.classList.add('dragout');
pom.click();