Modern Java
http://www.modernminds.com
O ptimizing for Internet Explorer 4

Microsoft Internet Explorer 4 has the ability to download and install Java class files on a client machine. This means that it is possible to automatically install the Ultimate Button Bar applet on a visitor's PC so that the browser does not need to download the applet each time that the site is visited (i.e., the applet is downloaded once, installed, then loaded from the hard drive each time that it is referenced thereafter).

This documentation is divided into three sections:
  • CAB File - how the CAB file works
  • OBJECT Tag - how a CAB file is inserted in the HTML
  • Examples - HTML examples of using the CAB file
IMPORTANT: Automatic installation of the Ultimate Button Bar using the CAB file will work for Internet Explorer 4 (or higher) ONLY.
T he CAB File

Included with the Ultimate Button Bar is a digitally signed CAB (CABinet) file named "UBB.cab." The CAB file is located in the IE4CABFile directory (the IE4CABFile directory is located in the Java directory). The CAB contains all of the Ultimate Button Bar Java class files, plus a special file that tells IE4 how to install the class files on the client machine. All of these files are compressed into a single package, then the file is digitally signed.

When Internet Explorer 4 downloads a web page that contains a digitally signed CAB file, the browser will display a security dialog asking whether the component should be installed. The dialog displayed should be similar to the illustration below:

CAB Security Dialog

If the "Yes" button is clicked, then the browser will install the Ultimate Button Bar on the hard drive. From this point on, IE4 will not need to transfer the applet from the web site. Instead, the browser will load the installed copy of the applet from the hard drive, thus allowing faster loading of the web page on subsequent visits to the site.

If the "No" button is clicked, then one of the following will occur depending upon how you have configured the applet:
  • If you have specified the UBB.jar file using the applet tag's ARCHIVE attribute and have included the UBB.jar file in the directory with the CAB file, then IE4 will download the UBB.jar file and run the Ultimate Button Bar from the JAR file instead of installing and running the class files from the CAB file.

  • If you did not specify the applet tag's ARCHIVE attribute, then the browser will attempt to download and run the Java "UBBApplet.class" file. If you have included one of the alternate "UBBApplet.class" files in the directory with the CAB file, then the alternate applet will load instead of the Ultimate Button Bar 2 (see the Supporting Java 1.0 documentation for information regarding the alternate applets).

  • If you did not specify the applet tag's ARCHIVE attribute, and if you did not include one of the alternate "UBBApplet.class" files in the directory with the CAB file, then the browser will not be able to load the applet and the applet area will blank on the page.
Using the CAB file can be a great way to build exciting web pages with sophisticated Java buttons that have little impact on the page's load time. The following section describes how to include the CAB file on a web page.
T he OBJECT Tag

Internet Explorer 4 uses the <OBJECT> tag to install components stored in a CAB file on a user's system. There are a number of ways that the <OBJECT> tag can be used, but for the purposes of installing the Ultimate Button Bar, the simple approach descibed below is all that is needed.

To enable the automatic installation of the Ultimate Button Bar on a user's system, the following tag should be inserted in the HTML before the APPLET tag:


<OBJECT CLASSID="clsid:1B9B4882-CDF8-11d1-A03D-0004ACEA3A7E" CODEBASE="UBB.cab#Version=2,0,0,0">
</OBJECT>

(see below for information on determining the version)

For our purposes, two attributes must be specified for the <OBJECT> tag: CLASSID and CODEBASE.

The CLASSID attribute is a special code that the browser uses to identify the Ultimate Button Bar. The browser uses the CLASSID to determine whether or not the Ultimate Button Bar is already installed on the system.

The CLASSID attribute must match the following exactly (you may copy the CLASSID value below and paste it into the <OBJECT> tag in your HTML):


clsid:1B9B4882-CDF8-11d1-A03D-0004ACEA3A7E

The CODEBASE attribute is a URL for the CAB file. If only the name of the CAB file is specified (i.e., CODEBASE="UBB.cab"), then the CAB file must be in the same directory as the HTML document.

Optionally, the CODEBASE attribute can also identify the version of the Ultimate Button Bar so that the applet will be automatically updated if a newer version of the applet exists on the server. For example, the CODEBASE attribute:


CODEBASE="UBB.cab#Version=2,0,0,1">

will cause the Ultimate Button Bar to be downloaded only if the version of the applet on the user's system is earlier than version 2.0.0.1.

Determining the Version: The release type of the Ultimate Button Bar is identified by the last digit of the version number.

A zero ("0") is used for the Shareware ("Demo") version and a one ("1") is used for the Registered version.

For example, the Shareware version number for the Ultimate Button Bar version 2.0 would be 2.0.0.0, and the Registered version number would be 2.0.0.1.

If there is a version 2.1 of the Ultimate Button Bar, then the version number would be 2.1.0.0 for the Shareware version, and 2.1.0.1 for the Registered version.

It is recommended that you always include the version number with the CODEBASE attribute so that if the user's system has an older (or Shareware) version of the applet installed, it will be replaced with the most current version.
E xamples

The <OBJECT> tag can be placed either inside of the <HEAD> section of the HTML, or inside of the <BODY> section of the HTML (before the <APPLET> tag).

For the examples in this section, the version identified in the <OBJECT> tag is the registered Ultimate Button Bar 2.0 applet. For the Shareware version 2.0 of the applet, the version would be identified with a zero in the last position instead of a one (i.e., "2,0,0,0").

The following is an example of placing the <OBJECT> tag inside of the <HEAD>.


<HTML>
<HEAD>

   <OBJECT CLASSID="clsid:1B9B4882-CDF8-11d1-A03D-
                    0004ACEA3A7E"
           CODEBASE="UBB.cab#Version=2,0,0,1">
   </OBJECT>

</HEAD>

<BODY>

   <APPLET ARCHIVE="UBB.jar" CODE="UBBApplet.class"
           WIDTH="350" HEIGHT="40">
   <PARAM NAME="UBBdefnFile" VALUE="MyButtonBar.txt">
   </APPLET>

</BODY>
</HTML>

Note: The CLASSID value should be placed on a single line

Alternately, the <OBJECT> tag can be placed in the HTML <BODY> section. If you use this method, place the <OBJECT> tag before the <APPLET> tag.

The following is an example of placing the <OBJECT> tag inside of the <BODY>.


<HTML>
<HEAD></HEAD>

<BODY>

   <OBJECT CLASSID="clsid:1B9B4882-CDF8-11d1-A03D-
                    0004ACEA3A7E"
           CODEBASE="UBB.cab#Version=2,0,0,1">
   </OBJECT>

   <APPLET ARCHIVE="UBB.jar" CODE="UBBApplet.class"
           WIDTH="350" HEIGHT="40">
   <PARAM NAME="UBBdefnFile" VALUE="MyButtonBar.txt">
   </APPLET>

</BODY>
</HTML>

Note: The CLASSID value should be placed on a single line
Copyright © 1998 by Modern Minds, Inc.