Microsoft SDK for Java

Accessing Cabinet Files From Web Pages

The HTML tags and parameters used to access cabinet files from Web pages differ depending on whether the cabinet contains applets or libraries.

Accessing Java Applets

To access Java applets, use the cabbase parameter in an <APPLET> tag to point to the .cab file. If the applet is not already present on the user's system, the .cab file is downloaded, the contents are extracted, and the applet is started.

To use the <APPLET> tag, set the parameters as shown in the following example:

<APPLET CODE="sample.class" WIDTH=100 HEIGHT=100>
<PARAM NAME="cabbase" VALUE="vendor.cab">
</APPLET>

Using the cabbase parameter does not conflict with codebase or any other parameters necessary for other browsers. Using cabbase, along with the other tags, allows Internet Explorer 3.0 and other browsers that support cab files to use them without impeding the ability of other browsers to download and execute applets.

You can also use the cabinets parameter to download multiple cabinet files from the same <APPLET> tag. This parameter can be used interchangeably with cabbase on Internet Explorer 4.0 or later. For example:

<APPLET CODE-"sample.class" WIDTH=100 HEIGHT=100>
<PARAM NAME="cabinets" VALUE="firstcab.cab, secondcab.cab">
</APPLET>

Accessing Java Libraries

To access Java libraries, use the <OBJECT> tag to point to the .cab file. The codebase attribute can specify a version number, which enables you to download and install libraries if the version on the user's system is out-of-date. Use the following HTML syntax:

<OBJECT CLASSID="<classid>" CODEBASE="<path to cab>#Version=x,x,x,x">
</OBJECT>

For example:

<OBJECT
    CLASSID="clsid:12345678-9abc-def1-1234567890ab"
    CODEBASE="cabs/vendor.cab#Version=1,0,0,12">
</OBJECT>

With this syntax, if the classes in the current version are not already present on the user's system, the .cab file is downloaded, and the contents are extracted and placed in the appropriate location.

Both the ClassId and the version number are also stored in the .inf file in the outer cabinet file. Including the version number is optional but highly recommended. This permanently installs the classes on the user's system—use this only for libraries.

After libraries are installed in this manner, <APPLET> tags can refer to the classes placed in the library specified by Cabs/Vendor.cab. Those applets work normally with classes brought in through cabbase or codebase.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.