0

How do you best create a download button to a PDF file on an external site, that is not on the current web server?

** EDIT **: PLEASE NOTE: we're currently not using HTML 5. I am not sure if we can switch. Please assume non-HTML 5.

I have tried a few things, including:

<h:outputLink value="https://www.external-site.de/media/pdf/Proxy-Configuration.pdf"
              target="_blank">

This navigates to the PDF in a new tab/window and shows the PDF inside the browser. Without the blank the new window stuff is omitted and the same happens.

I tried more, none of which I believe should be replicated here (none of them worked).

In any case, I want to show a download popup on the client immediately. I'd like to use some button component, as the requirement is a button. However, using a link and making it look like a button would be OK, too.

Q:

What is the correct/best approach to this using JSF/PrimeFaces?

Kawu
  • 13,647
  • 34
  • 123
  • 195
  • 1
    Possible duplicate of [(HTML) Download a PDF file instead of opening them in browser when clicked](https://stackoverflow.com/questions/6794255/html-download-a-pdf-file-instead-of-opening-them-in-browser-when-clicked) – Selaron Apr 15 '19 at 19:41
  • Hmmm. We're currently not using HTML5. It's been a question ever since, but no one has ever addressed it. Editing... – Kawu Apr 15 '19 at 22:10
  • In this case the accepted answer on the linked QA should be true for you: "You can't do this with HTML." - or one of the other pre-html5 answers. – Selaron Apr 16 '19 at 06:38

0 Answers0