简体   繁体   English

在不同的浏览器下检测已安装的插件?

[英]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. 到目前为止,我发现你可以通过试图猜测是否存在chrome://path/to/some/plugin/image.gif来“检测”firefox上的插件。

This code for firefox looks like this: 这个firefox代码看起来像这样:

<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? 我感兴趣的是代码在IE中看起来如何(对我来说更重要)以及是否还有其他方法可以为其他浏览器完成此任务?

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. 我想知道,因为我有一个白痴客户声称他没有安装插件,虽然我99,99%肯定他有。 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) :) 无论如何,我很高兴听到任何提示,技巧,变通方法等获取流行浏览器的插件列表(ff,即歌剧,铬,野生动物园):)

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 你可以试试这个: http//www.sliceratwork.com/detect-installed-browser-plugins-using-javascript

... but this is not going to detect browser add-ons like firebug, noscript, etc. ...但是这不会检测像firebug,noscript等浏览器插件。

That script seems to detect only the following plugins:- 该脚本似乎只检测以下插件: -

  • Java Java的
  • 3D Markup Language for Web Web的3D标记语言
  • DjVu 的DjVu
  • Flash
  • Google Talk Google Talk
  • Acrobat Reader 爱看阅读器
  • QuickTime 的QuickTime
  • RealPlayer RealPlayer的
  • SVG Viewer SVG查看器
  • Shockwave 冲击波
  • Silverlight Silverlight的
  • Skype Skype的
  • VLC VLC
  • Windows Media Player Windows媒体播放器
  • Xara Xara

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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