views:

996

answers:

4

What's the best way for determining whether the user's browser can view PDF files?

Ideally, it shouldn't matter on the browser or the operating system.

Is there a specific way of doing it in ASP.NET, or would the answer be just JavaScript?

+1  A: 

A quick google search found this. Useful for all kinds of plugins.

dawnerd
+12  A: 

Neither, none, don't try.

Re dawnerd: Plug-in detection is not the right answer. I do not have a PDF plugin installed in my browser (Firefox on Ubuntu), yet I am able to view PDF files using the operating system's document viewer (which is not Acrobat Reader).

Today, any operating system that can run a web browser can view PDF files out of the box.

If a specific system does not have a PDF viewer installed and the browser configured to use it, that likely means that either it's a hand-made install of Windows, a very trimmed down alternate operating system, or something really retro.

It is reasonable to assume that in any of those situation the user will know what a PDF file is and either deliberately choose not to be able to view them or know how to install the required software.

If I am deluding myself, I would love to have it explained to me in which way I am wrong.

ddaa
+1  A: 
Antony
+1  A: 

After initially ignoring the advise on this page the architect went ahead with Acrobat detection, causing an inevitable support nightmare.

As ddaa mentions not all the scenarios can be accurately captured with Plug-in detection. Some users, for example, may choose to view PDF files with FoxIt Reader rather than acrobat. Some user's browsers don't flag that they are Acrobat ready, and certainly not always in the same way.

A better solution would have been to give the user a choice on how they'd like to view the relevant document. Personally, I don't like to have any website rely on a plug-in - it spoils the beauty of the web.

Joe R
Using the small adobe icon vs. the internet explore icon has, to me, resembled pdf vs. html. It's unfortunate that IE reminds me of HTML, but...meh, what can you do
Swati