Click to See Complete Forum and Search --> : Forcing an Hyperlink to Download


Brachole
06-01-2008, 09:14 PM
I have an Hyperlink, which I'd would like the user to download rather than open it. Example, I have this hyperlink:

<a href="http://website.com/Document.pdf>Download PDF</a>

If you left click on this, it will simply open the PDF. I want the user to Download the pdf instead. Instead of asking hte user to "Right-Click and Save As...", I want the user to Downlaod as soon as he clicks on it...

felgall
06-01-2008, 09:17 PM
You need to set the content-disposition in the HTTP header to attachment to do that. The easiest way to do that is to pass the PDF through an server side script that adds the appropriate headers.