简体   繁体   中英

Detecting installed plugins under different browsers?

I'm wondering if there is a way to detect installed plugins on different browsers. So far I have found that you can "detect" plugins on firefox by trying to guess if chrome://path/to/some/plugin/image.gif exists.

This code for firefox looks like this:

<img src="chrome://firebug/content/blank.gif" onload="var a=document.getElementById('FireBug'); a.innerHTML = 'You are using FireBug';" style="visibility:hidden">
<div id="FireBug">You are not using FireBug</div>

I'm interested how does the code look in IE (more important to me) and if there are other ways to accomplish this task for other browsers too?

I want to know because I'm having an idiot client who claims he doesn't have installed plugins though I'm 99,99% sure he has. The problem is that some of those plugins are breaking parts of a web site admin control panel I've wrote.

Anyway I'd be glad to hear any tips,tricks,workarounds and etc for getting the plugin list of the popular browsers (ff,ie,opera,chrome,safari) :)

This code will list all the plugins installed in the browser

<html>
<body>
<div id="example"></div>
<script type="text/javascript">
var x=navigator.plugins.length; // store the total no of plugin stored 
var txt="Total plugin installed: "+x+"<br/>";
txt+="Available plugins are->"+"<br/>";
for(var i=0;i<x;i++)
{
  txt+=navigator.plugins[i].name + "<br/>"; 
}
document.getElementById("example").innerHTML=txt;
</script>
</body>
</html>

This code will give you all the info you need:

<HTML>
<HEAD>
<TITLE>About Plug-ins</TITLE>
</HEAD>
<BODY>
<SCRIPT language="javascript">
numPlugins = navigator.plugins.length;

if (numPlugins > 0)
  document.writeln("Installed plug-ins");
else
 document.writeln("No plug-ins are installed.");

for (i = 0; i < numPlugins; i++) {
 plugin = navigator.plugins[i];
 document.write("<center><font size=+1><b>");
 document.write(plugin.name);
 document.writeln("</b></font></center><br>");
 document.writeln("<dl>");
 document.writeln("<dd>File name:");
 document.write(plugin.filename);
 document.write("<dd><br>");
 document.write(plugin.description);
 document.writeln("</dl>");
 document.writeln("<p>");
 document.writeln("<table border=1 >");
 document.writeln("<tr>");
 document.writeln("<th width=20%>Mime Type</th>");
 document.writeln("<th width=50%>Description</th>");
 document.writeln("<th width=20%>Suffixes</th>");
 document.writeln("<th>Enabled</th>");
 document.writeln("</tr>");
 numTypes = plugin.length;
 for (j = 0; j < numTypes; j++)
 {
  mimetype = plugin[j];

  if (mimetype){
   enabled = "No";
   enabledPlugin = mimetype.enabledPlugin;
   if (enabledPlugin && (enabledPlugin.name == plugin.name))
    enabled = "Yes";
   document.writeln("<tr align=center>");
   document.writeln("<td>");
   document.write(mimetype.type);
   document.writeln("</td>");
   document.writeln("<td>");
   document.write(mimetype.description);
   document.writeln("</td>");
   document.writeln("<td>");
   document.write(mimetype.suffixes);
   document.writeln("</td>");
   document.writeln("<td>");
   document.writeln(enabled);
   document.writeln("</td>");
   document.writeln("</tr>");
  }
 }
 document.write("</table>");
}
</SCRIPT>
</BODY>
</HTML>

You could try this: http://www.sliceratwork.com/detect-installed-browser-plugins-using-javascript

... but this is not going to detect browser add-ons like firebug, noscript, etc.

That script seems to detect only the following plugins:-

  • Java
  • 3D Markup Language for Web
  • DjVu
  • Flash
  • Google Talk
  • Acrobat Reader
  • QuickTime
  • RealPlayer
  • SVG Viewer
  • Shockwave
  • Silverlight
  • Skype
  • VLC
  • Windows Media Player
  • Xara

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM