Application requests KML data through AJAX from server. This data is stored in javascript variables, and displayed in Google Earth plugin.
In javascript, how do I
Check out http://regany.com/blog/2014/05/30/convert-a-string-to-a-download-file-in-javascript/
Enable popups and use the following code:
var str = "the string you wan't to download"; window.open('data:text/plain,' + encodeURIComponent(str));