我的团队希望为firefox/chrome/IE构建一个“插件”。 如何使用javascript检测是否安装了此插件(不是扩展名)?如何检测Firefox/IE/Chrome中的自定义插件?
我想要一块javascript可以检测是否安装了某个插件。如果已安装,则返回true,否则返回false。
例如...我如何获得插件列表,然后循环查看它们中的一个是否与我的插件名称匹配?如果匹配,则返回1.
我的团队希望为firefox/chrome/IE构建一个“插件”。 如何使用javascript检测是否安装了此插件(不是扩展名)?如何检测Firefox/IE/Chrome中的自定义插件?
我想要一块javascript可以检测是否安装了某个插件。如果已安装,则返回true,否则返回false。
例如...我如何获得插件列表,然后循环查看它们中的一个是否与我的插件名称匹配?如果匹配,则返回1.
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>")
您可以通过这段JavaScript代码获取浏览器插件:
<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>
<br/>
<script>
也许你可以接受@Matt的答案,他指出'navigator.plugins'的能力? – ceejayoz 2009-12-14 23:03:03
我试过了,但它不会让我。由于某种原因,支票被锁定 – TIMEX 2009-12-14 23:55:21