I currently have this code:
function download(filename, text) { var pom = document.createElement('a'); pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); pom.setAttribute('download', filename); pom.click(); } download('test.html', string);
string contains a lot of HTML code that is written to the HTML file.
The above code works fine: when you click the button, the browser (chrome) automatically loads the HTML file with the contents of the string written to it.
Now, instead of automatically downloading the chrome file, I want to open the "save as" dialog box and ask the user for the location and name of the file, and then upload it to this place.
A quick simple answer would be greatly appreciated.
source share