5.3 ActiveX Controls and Plugins


ActiveX controls (formerly OLE controls) are reusable components that add functionality to Internet Explorer on Windows only. Macintosh browsers and Netscape Navigator for Windows use Netscape-style plugins to provide similar functionality. Many accessories, including Flash and Shockwave, are available in both forms to support all major browsers.

Whereas prior versions of Internet Explorer for Windows supported both ActiveX controls and Netscape-style plugins, IE5.5 SP2 and IE6.0 do not support Netscape-style plug-ins. They now require ActiveX controls exclusively.

The <object> tag is used to insert ActiveX controls. For Flash and Shockwave objects (which are available as both ActiveX controls and Netscape-style plugins), Dreamweaver automatically inserts both the <object> and <embed> tags (the latter is actually included within the <object> tag). Browsers that recognize the <object> tag, such as Internet Explorer for Windows, ignore the <embed> tag; browsers that don't understand the <object> tag use the <embed> tag instead. Therefore, attributes not specific to one of the tags must be specified redundantly in both tags. (Example 5-1 demonstrates how attributes are specified, which differs slightly for each tag.)

The classid and codebase attributes are specific to the <object> tag. The classid uniquely identifies an ActiveX control, which is downloaded from the URL specified by the codebase attribute if it is not already installed. (The #version number is appended to the codebase attribute, as shown in Example 5-1, to ensure that the latest version of the ActiveX control is installed.) For more details on the <object> tag, see http://www.w3.org/TR/REC-html40/struct/objects.html#edef-OBJECT.

The pluginspage attribute is specific to the <embed> tag; as with the <object> tag attributes described previously, it tells the browser where to download the missing plugin from. Attributes other than pluginspage , classid , and codebase must be specified for both tags.

5.3.1 Inserting ActiveX Controls

Dreamweaver lets you insert ActiveX controls and supply attributes for any required parameters. ActiveX controls have an .ocx or .cab file extension, but are typically selected by their Class IDs, not their filenames.

To insert an ActiveX control:

  1. Use Insert figs/u2192.gif Media figs/u2192.gif ActiveX or the Insert ActiveX icon in the Objects panel's Special category (see Figure 5-1) to insert the object.

  2. Select the ActiveX control placeholder that appears in the Design pane of the Document window.

  3. Open the Property inspector (Window figs/u2192.gif Properties) for the ActiveX object, as seen in Figure 5-15.

  4. Choose a ClassID from the popup menu in the Property inspector (the ClassIDs for RealPlayer, Flash, and Shockwave are preconfigured).

  5. Set the additional properties as necessary.

  6. Configure parameters by using the Parameters button in the Property inspector.

You can add your own ClassIDs to the Property inspector by editing the file at Dreamweaver4/Configuration/ActiveXNames.txt .

Figure 5-15 shows the Property inspector as it appears when an ActiveX control is selected.

Figure 5-15. The Property inspector for ActiveX controls
figs/dwn_0515.gif

Inserting an ActiveX control adds an <object> tag to your HTML similar to the following code:

 <object width="300" height="300"          classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">   <embed width="32" height="32" src="Activeup.cab">   </embed>  </object> 

Prior to QuickTime 5.0.2, the QuickTime installer installed a Netscape-style plugin only. In addition to the plugin, the latest QuickTime installer includes an ActiveX control to support the latest version of Internet Explorer for Windows.

Example 5-2 shows code used to insert the QuickTime ActiveX control and Netscape-style plugin. This code must be entered by hand in Dreamweaver's Code view.

Example 5-2. HTML for inserting the QuickTime ActiveX control and plugin
 <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"     width="160" height="144"     codebase="http://www.apple.com/qtactivex/qtplugin.cab">     <param name="src"        value="sample.mov">     <param name="autoplay"   value="true">     <param name="controller" value="false"> <embed src="sample.mov" width="160" height="144"       autoplay="true"    controller="false"       pluginspage="http://www.apple.com/quicktime/download/"> </embed></object> 

Don't change the codebase , classid , or pluginspage attributes. The other attributes, such as height , width , and src , should be changed in both places they appear. For details on other attributes of the QuickTime plugin, see http://www.apple.com/quicktime/authoring/embed.html. Chapter 12 explains how to use the Check Plugin behavior to test for the QuickTime plugin.

5.3.2 Inserting Plugins

Although ActiveX controls were preferred by Internet Explorer for Windows, until recently, all major browsers supported Netscape-style plugins. Therefore, using an <embed> tag alone to embed a document requiring a plugin was common.

If you support IE5.5 SP2 and IE6.0, which no longer use Netscape-style plugins, you should insert plugins using HTML similar to that shown in Example 5-2.

Once the QuickTime or other ActiveX control has been installed on a user 's system, IE5.5 SP2 and IE6.0 use it to display the custom asset type when encountering an <embed> tag.

If your site doesn't support the latest Internet Explorer for Windows browsers, or if an ActiveX control counterpart to the plugin is not available, use the <embed> tag alone. To insert asset types that require a plugin, use Insert figs/u2192.gif Media figs/u2192.gif Plugin or the Insert Plugin tool in the Objects panel's Special category (see Figure 5-1).

In the Select File dialog box, pick the filename of the external asset you want to insert into the page. Select an asset file that requires a plugin, such as a QuickTime .mov file or an Authorware ( .aam ) file, not the plugin itself. If you select an unknown filetype, Dreamweaver inserts a Plugin placeholder icon (which looks like a puzzle piece).

Figure 5-16 shows the Property inspector as it appears when a Plugin placeholder is selected.

Figure 5-16. The Property inspector for Plugins
figs/dwn_0516.gif

Inserting a Plugin adds an <embed> tag to your HTML document similar to:

 <embed src="/flashobjs.rm" width="32" height="32"> </embed> 

If you select a file of one of the supported types, such as .png , .swf , or .dcr , Dreamweaver inserts the corresponding type of object instead of a Plugin placeholder. For example, using the Insert Plugin tool to insert a .swf file is the same thing as using the Insert Flash tool. In such a case, the Property inspector reflects the properties of the recognized asset type.

The Insert figs/u2192.gif Media figs/u2192.gif Plugin command inserts a generic plugin container. See the Rich Media category in the Dreamweaver Exchange for extensions that are tailored to insert plugins for QuickTime video, RealAudio, RealVideo, and other popular media types. See Chapter 22 for details on downloading and installing extensions from the Dreamweaver Exchange.

Naturally, the user must have the plugin installed to view the specialized content. If the user doesn't have the plugin installed, the browser displays a broken puzzle-piece placeholder. Netscape-style plugins under Windows typically have a .dll extension and are stored in the browser's Plugins folder. Macintosh plugins are indicated by the hidden file type NSPL (all uppercase) and are stored in the browser's Plug-ins folder.



Dreamweaver in a Nutshell
Dreamweaver in a Nutshell
ISBN: B000C4SPTM
EAN: N/A
Year: 2005
Pages: 208

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net