Download anchor tag

I want the download to start as you click it but it opens the file in new/same tab than either you click download if pdf or right click save image as if it's an image.
<a href="./padfile.pdf" download="PDF File">Download</a>
<a href="./padfile.pdf" download="PDF File">Download</a>
3 Replies
vince
vince2y ago
I don't recommend doing this. Seems to me to be bad for user experience and accessibility You'd want an anchor tag that works as both a link and a button, so you'd be fighting with semantics as well
Malik
Malik2y ago
Every video I've seen where they use the anchor tag with download attribute their file dowloads just by clicking the tag. Mine just opens up. (tried image,pdf they just open up). What am I missing here. sorry for the late reponse.
vince
vince2y ago
Ah I didn't know that the anchor tag had a download attribute, disregard
Want results from more Discord servers?
Add your server