HTML and CSS Reference
In-Depth Information
Shockwave or Flash player, Adobe Acrobat Reader, and RealNetworks RealPlayer. Plug-
ins can be platform dependent and their MIME types can vary as well. If you are using
Firefox, go to the Tools menu and select Addons to get more information about the plug-
ins supported on your client. If using Internet Explorer, you will find the plugins[] array
is empty. You can manage add-ons by going to the Internet Explorer Tools menu and
clicking Manage Add-ons.
The plugins[] array of the navigator object (starting with Navigator 3) contains a com-
plete list of installed plug-ins and can be numerically indexed to see all plug-ins installed
for this browser. Each element of the plugins[] array represents a plugin object. The prop-
erties of the plugin object are shown in Table 10.2. When you use the HTML <embed>
tag in a document, you are creating a plugin object. Each instance of the <embed> tag cre-
ates another object (see <embed> and <object> tags for embedding objects on page 281,
Example 10.5).
Table 10.2 Properties of the plugin Object
Property
What It Describes
description
A description of the plug-in.
filename
The disk file name of the plug-in.
length
The number of elements in the plugins[] array.
name
The name of the plug-in.
EXAMPLE 10.4
<script type="text/javascript">
// No plug-ins for Windows IE. Firefox uses this program.
1
var num_of_plugins = navigator.plugins.length ;
2
for (var i=0; i < num_of_plugins; i++) {
var number=i+1;
document.write("<font color=red>Plug-in No." +
3
number + "- </font>"+ navigator.plugins[i].name +"
<br />[Location: " + navigator.plugins[i].filename + "]<p>");
}
4
alert("\nYou have " + number + " plug-ins installed!")
</script>
EXPLANATION
1
The length property specifies the number of elements in the plugins[] array. If us-
ing Internet Explorer for Windows, then you will need to use the HTML <object>
tag and identify a class ID.
2
The plugins[] array consists of a list of plug-ins that have been installed in this brows-
er. The for loop is used to go through the array, one by one, listing each plug-in.
Continues
 
Search WWH ::




Custom Search