|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Is there a way to detect if the browser has installed a pdf-viewer plug-in?
I have some pdf-files, and I want users requesting them redirected to a "you need the pdf-reader plug-in" page if they cannot view pdf-files. Thanks in advance, Guttorm. |
|
#2
|
|||
|
|||
|
I have no experience with it but have you tried:
plugin.description (JavaScript 1.1) navigation.plugins (JavaScript 1.1) plugs=navigator.plugins; len = plugs.length; for (i=0; i<len; i++) { MimeType = plugs[i]; text = "Plugin "+i+" supports MimeType: '"+MimeType.type+"'"; window.alert(text) } Ulf |
|
#3
|
|||
|
|||
|
Thanks a lot. I was able to make a function to detect the plug-in that looks like this:
function PdfMimeOk() { if (navigator.appName == "Netscape") { i = navigator.mimeTypes.length; while (i--) { if (navigator.mimeTypes[i].suffixes == "pdf") return true; } } return false; } This works fine in Netscape (therefore the check), but in Internet Explorer, the navigator.mimeTypes (as well as the navigator.plugins) arrays are always empty. Any ideas what to do in Internet Explorer? |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > detection of the pdf-reader plugin |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|