Main Page

ActiveX Controls

All non-IE browsers ignore this code block because
is unrecognized as a scripting lan-
guage; therefore, it’s safe to include this in your cross-browser pages (although it is still recommended
that this reside in the
element to prevent rendering of the code as plain text). Another alterna-
tive is to place the VBScript into an external file (ending in .vbs) and load it into the page like this:
<script language=”VBScript” src=”example.vbs”></script>
Because of the intricate workings of
, many developers simply choose to use
JavaScript communication.
ActiveX Controls
In Internet Explorer on Windows, you can embed ActiveX controls in the page by using the
element. To do this, you need to know the class ID of the ActiveX control you wish to embed (this infor-
mation can be gleaned using the OLE/COM Object Viewer) and insert it as the
<object classid=”activex_class_id” id=”ActiveXControl”></object>
Not all ActiveX controls behave properly when embedded in a Web page. Indeed, some of them trigger
security warnings in Internet Explorer and possibly in software such as antivirus programs. However, a
few ActiveX controls were designed to work appropriately and safely in Web pages. One such compo-
nent is the tabular data control.
The tabular data control has no visual component to it, so it is an invisible object on your page. At first
glance, it hardly looks exciting — especially when compared to what you can do with Java and Flash.
At second glance, however, the tabular data control reveals some powerful functionality that allows
JavaScript to use database-like functionality.
Specifically, the tabular data control allows you to use a flat text file as if it were a database table. You tell
the control what the value delimiter character is, and it parses the text file into a series of rows and values.
To create a tabular data control on a page, you must use the class ID
(retrieved using the OLE/COM Object Viewer) and give the object an ID:
<object classid=”CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83” id=”TextData”>
Next, you must specify the
parameter, which indicates where the text file is located (this can be
either a relative or complete URL), and the
parameter, which indicates what the delimiter is
between two values in the same row (most often this is a comma):
ActiveX-based plugins do not work on any non-Windows browser because ActiveX
is a Windows-specific technology. On Windows XP Service Pack 2, any ActiveX con-
trol that attempts to contact an outside server or is capable of accessing a local file
triggers a warning.
Chapter 18
21_579088 ch18.qxd 3/28/05 11:43 AM Page 558

JavaScript EditorFree JavaScript Editor     Ajax Editor