What is the best way to always force a PDF, open from a link in a web page, to be open in a new tab/window of the web browser. What I want to avoid is some browsers showing an empty window and downloading the PDF directly to a local folder.

I'm looking for a cross browser solution.

link|improve this question
feedback

migrated from stackoverflow.com Nov 26 '10 at 22:49

This question came from our site for professional and enthusiast programmers.

3 Answers

It is not possible. Even if you don't have a PDF reader installed, it would get downloaded.

link|improve this answer
feedback

According to the Content-Disposition RFC, the Content-Disposition header is optional, and in its absence the user-agent (browser) can decide how to handle each file. From memory, if you can set the Content-Disposition to inline it will force the browser to open the file in a browser window. If it is set to attachment this will force the save file dialog to appear.

To get this to happen in PHP you could have a proxy script that sets the Content-Disposition header, sets the other required headers (such as Content-Type: application/pdf from memory), then writes the file. There may be better solutions using .htaccess rules that I'm unaware of.

This question (as I've interpreted it) really belongs in Stack Overflow IMO as this is something developers are concerned with, not users.

link|improve this answer
feedback

You have to add the MIME type in your Browser or edit it I Opera it is: menu->preferences->downloads: Look if you can find the mime type PDF. Then click add or edit.

MIME type: application/pdf Extention: pdf And then invoke the option: USE PLUGIN Adobe Acrobat

Hope this works for you

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.