Javascript – How can I make a browser display a 'Save As' dialog when a button is clicked in an Angular application, ensuring it works on all browsers?
You can make use of showSaveFilePicker, but its browser support is very limited. It may work with Chrome/Edge in Windows & Mac, but won’t work in mobile.
e.g. : The following code will download a text file with ‘Save As’ dialog box.
3
Answers
to get pop up, you have to change your browsers settings (Ask where to save each file before downloading) enter image description here
Try the following example:
Another way is:
1 – Install dependencies for show save/open file pop-up
2- Create a service with this function to receive the data
3- In the component parse the blob with ‘file-saver’
You can make use of showSaveFilePicker, but its browser support is very limited. It may work with Chrome/Edge in Windows & Mac, but won’t work in mobile.
e.g. : The following code will download a text file with ‘Save As’ dialog box.