Fraser
Fraser

Reputation: 14246

Give an option to download pdf OR open in browser

I'm pretty sure this isn't possible but thought I'd check with you guys.

I've just had a bizarre query from a client who wants to know if it's possible to give the user the option to either download a pdf or open it in their browser.

They have a thumbnail for the PDF. Single click to open it in the browser or double click to download it. I know I can catch the single or double click with jQuery. I just want to know if it's possible to force the behaviour of the link.

Thanks

Upvotes: 0

Views: 292

Answers (1)

Alex
Alex

Reputation: 1668

This is possible, if for example you are using PHP you can create 2 methods, once will be a simple direct link to the pdf file (if a customer has adobe reader then it will open the pdf in the browser otherwise it will force a download), the other method would always force a download.

You can find a PHP force file download example here: How to force download of a file?

Upvotes: 2

Related Questions