I am facing a challenge with downloading a base64 image onto the user's machine.
So far, I have attempted the following steps:
var url = base64Image.replace(/^data:image\/[^;]+/, 'data:application/octet-stream');
window.open(url);
and
window.location.href = base64Image.replace('image/png', 'image/octet-stream');
While these methods do allow me to download the image to a specific location, I would like to give the user the ability to provide a file name as well. Something similar to the saveAs method. Any suggestions on how to achieve this?
Additionally, I am curious if there is a way to handle the ok/cancel buttons that appear in the save dialog.