This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
If I remove "attachment" from the line above, the PDF will display in the browser. If I leave the code as-is, then the user is prompted to either save or view the PDF. If the user chooses to view the PDF, the PDF is displayed in Acrobat. I would like to find a middle ground. I would like to prompt the user to either save or view the PDF, however; if the user chooses to view the PDF, I would like to display it in the browser...not in seperate Acrobat. Is this possible? How? Thank you for the help.
Jeroen T Wenting
posted 9 years ago
You can't. Either you force a save-as prompt like that or let the browser decide what to do. In the latter case the browser will display the PDF in some way if it can (meaning it has a PDF reader plugin or built-in capability) and otherwise will prevent a prompt asking the user what to do.
PS, this has nothing at all to do with Java per se.