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
After try what Andreas said I will add something:
Script:
function createAndOpenFile(){
var stupidExample = 'something ';
document.open('data:Application/octet-stream,' + encodeURIComponent(stupidExample));
}
You have a link like this, note the new download atribute, with it you put the file name.
Donwload
It works at least in Chrome 27 and Firefox 21.
Improved are welcome :-)