snowberb – 09-12 Aug 3

If I want to download a PDF file, how can I make the navigator to download it instead of the app itself? What I mean is, right now I have to fetch the pdf, and then I convert it to a link, but once I get the link, the pdf is already dowloaded, what I want is to use the navigator to tell how much time left for the file to download
S
ScriptyChris259d ago
Why don't you put that PDF's link on the <a> in HTML instead of fetching it from JS?
S
Sniberb259d ago
the pdf is stored in base64
S
ScriptyChris259d ago
So how do you download it now?
S
ScriptyChris259d ago
You can try setting content-diaposition: Attachment HTTP response header for that file to instruct browser to download it when linked is clicked https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
Content-Disposition - HTTP | MDN
In a regular HTTP response, the Content-Disposition response header is a header indicating if the content is expected to be displayed inline in the browser, that is, as a Web page or as part of a Web page, or as an attachment, that is downloaded and saved locally.
UU
Unknown User258d ago