I have a link that should open a PDF in a new tab.
This works as expected on localhost but after I deploy the site the link downloads the pdf instead of opening it.
<a download="" target="_blank" href="https://www.my-domain.com.au/foo.pdf">Open PDF</a>
How can I ensure the link opens the file in a new tab instead of downloading it?
The actual code is using Nextjs Link, React JSX.
<Link href={href}>
<a
download={true}
target="_blank"
rel={isExternal ? 'noopener' : undefined}
>
Open PDF
</a>
</Link>
I am using Chrome
CodePudding user response:
The HTML5 specification says:
The
download
attribute, if present, indicates that the author intends the hyperlink to be used for downloading a resource.
So, try to remove it.