↑
Main Page
Detecting ActiveX plugins
The last thing to be aware of is that the
navigator.plugins
collection can sometimes become out of
date, or
stale
, as the user is downloading a plugin required for viewing your page. To prepare for this
possibility, you should always start out by refreshing
navigator.plugins
by calling the
refresh()
method. This method accepts one argument, a Boolean value, indicating whether the browser should
reload the page (or pages) using an embedded object; to reload the pages, pass in
true
, otherwise, pass
in
false
. For example:
navigator.plugins.refresh(true); //reload all pages using plugins
Making this simple call could save you some heartache later on.
Detecting ActiveX plugins
Because Internet Explorer plugins are just ActiveX controls, all you need to know is the name of the con-
trol to detect if it is installed. Earlier in this book, you saw some code to detect the latest version of the
Microsoft XML DOM. This same methodology can be used for any IE plugin. But how do you find the
name of the ActiveX control you’re interested in?
Microsoft has a tool called the OLE/COM Object Viewer that can be used to find the ActiveX control
name for all ActiveX controls installed on your computer. You can download this tool for free from
http://www.microsoft.com/downloads/details.aspx?FamilyID=5233b70d-d9b2-4cb5-
aeb6-45664be858b6&displaylang=en
. After it is installed, it provides a list of all OLE, COM, and
ActiveX objects installed on your machine as well as important information about each one. It may take
some time to look through all of the installed objects, but once you find the one you’re looking for, all the
pertinent information is displayed (Figure 18-1).
The important piece of information is listed as
VersionIndependentProgID
, which gives you the name
of the generic ActiveX control that creates the most recent version of the control. The
ProgID
listed typi-
cally gives you a version-specific control name, which helps to determine if a specific version is installed
(although it doesn’t always list the highest version available). The following table lists the version-
independent and version-specific ActiveX control names for several popular plugins.
Presently, Netscape Navigator 3.0+, Opera 5.0+, Safari 1.0, Internet Explorer 5.0+
(Macintosh only), Internet Explorer 3.0-5.5 SP 1 (Windows), and all Mozilla-based Web
browsers support this functionality; Internet Explorer 5.5 SP 2+ on Windows does not,
even though it creates both
navigator.plugins
and
navigator.mimeTypes
(each is
a collection with zero items).
540
Chapter 18
21_579088 ch18.qxd 3/28/05 11:43 AM Page 540
Free JavaScript Editor
Ajax Editor
©
→