I'm developing a platform for sharing the pdf version of books and hence need to allow the users to be able to download the pdf. I'm using Firebase storage to hold the uploaded pdfs. I'm not being able to figure out to download the selected pdf on users computer when I have the URL of the file.
I've tried this on javascript..
var element = document.createElement('a'); //created the anchor element
element.setAttribute('href', url); //i know the url, hence setting the href
element.setAttribute('download', 'dnpdf'); //setting the name of the downloaded file
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
This downloads a blank file; not the one expected