Can't Download PDF File from a Different Server #70238
Unanswered
argene-mosedcorp
asked this question in
Help
Replies: 1 comment
-
Why are you using anchor tag in Nextjs instead of you should use
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I'm trying to implement a button that will download a PDF file. However, instead of downloading the file, it just opens the URL in a new browser tab.
Here is my current code:
<a href="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" target="_blank" rel="noopener noreferrer" locale={false} download><button>Download Dummy PDF</button></a>
Issue:
When I click the button, it opens the PDF in a new tab instead of downloading it.
What I've Tried:
Using the download attribute within the Link component.
Opening the URL directly in the browser, which works but doesn't force a download.
Context:
The PDF file is hosted on a different server.
I need the button to trigger a download of the PDF file.
Question:
How can I modify my code to ensure the PDF file is downloaded instead of being opened in a new tab?
Thanks in advance for your help!
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions