views:

355

answers:

2

My team wants to build a "plugin" for firefox/chrome/IE. How do I use javascript to detect if this plugin (not extension) is installed?

I would like to have a piece of javascript that can detect if a certain plugin is installed. Returns true if installed, returns false otherwise.

For example...how do I get a list of plugins, and then loop through to see if one of them match my plugin name? If match, return 1.

+7  A: 

navigator.plugins will have an array of plugins that you can check.

This exists for Firefox, Chrome, and IE (at least version 8, I don't have a lower version to test)

Here's what the array looks like in webkit:

Plugins Array in Webkit

Matt
Browser DOM capabilities have really evolved so much. Nice.
Braveyard
hello Matt,i tried to use navigator.plugins to detect plugins installed on client machine. but it doesn't work with IE. can you guide me in that please?
Radhi
A: 
solved:

document.writeln("<TABLE BORDER=1><TR VALIGN=TOP>",
   "<TH ALIGN=left>i",
   "<TH ALIGN=left>name",
   "<TH ALIGN=left>filename",
   "<TH ALIGN=left>description",
   "<TH ALIGN=left># of types</TR>")
for (i=0; i < navigator.plugins.length; i++) {
   document.writeln("<TR VALIGN=TOP><TD>",i,
      "<TD>",navigator.plugins[i].name,
      "<TD>",navigator.plugins[i].filename,
      "<TD>",navigator.plugins[i].description,
      "<TD>",navigator.plugins[i].length,
      "</TR>")
}
document.writeln("</TABLE>")
TIMEX
Maybe you could accept the answer of @Matt, who pointed out the `navigator.plugins` ability?
ceejayoz
I tried, but it won't let me. For some reason the check is locked
TIMEX