I'd like to let users to download images by clicking on a download icon:
The image file is already fetched from the server and displayed:
<img :src="currentMediaUrl">
The button is intended to force the browser to download the image above:
<i @click="downloadMedia(currentMediaUrl)" class="fa fa-download"> </i>
Here is what I've tried:
downloadMedia(media) {
let uriContent = "data:application/octet-stream," + encodeURIComponent(media);
window.open(uriContent, 'neuesDokument');
},
But it downloads a file containing the media URI instead of the very file.
How can I fix it?