Detecting Plugins in Internet Explorer - How Navigator Handles the Problem
(Page 2 of 7 )
Netscape Navigator tackles this problem by using an array built directly into the browser object, called simply plugin (navigator.plugins), that lists all of the plug-ins installed in the browser. This array can then be accessed quickly and efficiently through the use of the ever-popular scripting language JavaScript, provided version 1.1 or above is supported. A simple document that makes use of the .plugins property can be put together as follows:
<html>
<head>
<title>Netscape Plugin Detection</title>
</head>
<body>
<h1>The plugins you have installed are:</h1>
<script language='JavaScript'>
if (navigator.plugins){
for (i=0; i < navigator.plugins.length; i++){
document.writeln("Plugin Name: " + navigator.plugins[i].name + "<br>");
}
}
</script>
</body>
It is messy, in part because some of the plug-ins are listed more than once, but it works with a minimal amount of effort. The plugins array has some additional properties such as .filename and .description, which provide, yes, you’ve guess it, information on the filename of the plug-in, and a brief description of the plug-in, such as:
Plugin Filename: npswf32.dll
Plugin Description: Shockwave Flash 7.0 r19
Next: IE's Approach >>
More Windows Scripting Articles
More By Dan Wellman