In case anyone is still wondering…
I did it like this:
<a href="data:application/xml;charset=utf-8,your code here" download="filename.html">Save</a>
can’t remember my source but it uses the following techniques\features:
- html5 download attribute
- data URI’s
Found the reference:
http://paxcel.net/blog/savedownload-file-using-html5-javascript-the-download-attribute-2/
EDIT:
As you can gather from the comments, this does NOT work in
- Internet Explorer (however works in Edge v13 and later)
- Opera Mini
http://caniuse.com/#feat=download