Sniberb
Sniberb12mo ago

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
5 Replies
ScriptyChris
ScriptyChris12mo ago
Why don't you put that PDF's link on the <a> in HTML instead of fetching it from JS?
Sniberb
Sniberb12mo ago
the pdf is stored in base64
ScriptyChris
ScriptyChris12mo ago
So how do you download it now?
ScriptyChris
ScriptyChris12mo 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.
reactibot
reactibot12mo ago
This thread hasn’t had any activity in 36 hours, so it’s now locked. Threads are closed automatically after 36 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1136587337099386900