hussain hussain - 1 year ago 127
Javascript Question

How to prompt save as option for user to download file using chrome?

I have method that is downloading file whenever this method called it is working as expected, I just see difference in browser in IE user has option to save As file but in chrome it directly download the file , How can we have that feature in chrome so user can use Save as option while saving the file so they can name the file ?


function deleteFile(filename){
console.log('data for download', response);
var data = JSON.stringify(;
var blob = new Blob([data], { type: 'text/plain;charset=utf-8' });
FileSaver.saveAs(blob, 'server.log');

Answer Source

What you are asking isn't possible.
It's a user preference

enter image description here


The only thing you can do is letting the user rename server.log inside a input element or a window.prompt before saving

saveAs(blob, prompt('Filename?', 'server.log') || 'server.log');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download