The tags “embed” and “applet” are deprecated and even dropped in the new browser standards like XHTML 1.1. To embed objects within a document, the tag “object” should be used. The main attributes of “object” are:
- classid : This attribute contains a URL for an object’s implementation. The URL syntax depends upon the object’s type. With ActiveX controls (Internet Explorer), the value of this attribute is not a URL, but an object-id with the prefix clsid. The way to access a Java applet is to use classid=”java: classname.class”. The pseudo-URL java: is used to indicate a Java applet.
- data : This attribute contains a URL for data required by an object.
- archive : This attribute contains a URL for the location of an archive file. An archive file typically is used to contain multiple object files to improve the efficiency of access.
- codebase : This attribute contains a URL to use as a relative base to access the object specified by the classid attribute.
- codetype : This attribute specifies an object’s MIME type.
- type : This attribute specifies the MIME type for the object’s data.
- declare : This attribute declares an object without instantiating it. This is useful when the object will be a parameter to another object.
- name : Under the Microsoft definition, this attribute defines the name of the control so scripting can access it.
- standby : This attribute contains a text message to be displayed while the object is loading.
- width, height : the size of the object
The tag “param” specifies the parameters that are needed by the object to run. Most attributes exist also as parameter elements, but should never be used duplicated, except for the codebase attribute. In the “object” tag, the codebase attribute represents the location from which to download the object (for instance the Java plugin) when it is not found on the local machine. In the “applet” tag, the codebase attribute represents the location from which to download additional class and jar files. To resolve this conflict, the codebase attribute is mapped into a “param” codebase in the “object” tag.
Specific parameters are the following:
- scriptable : Specifies whether the applet is scriptable from the HTML page using JavaScript or VBScript. The value can be either “true” or “false”.
- mayscript : Specifies whether the applet is allowed to access “netscape.javascript.JSObject”. The value can be either “true” or “false”.
- code : Specifies the name of the Java applet or JavaBeans component witout the extension “class”. It cannot be used with “param” element “object” nested inside the same “object” tag.
Microsoft Internet Explorer handles the “object” tag differently than other browser like Firefox, mainly due to the different implementation of the “classid” attribute. To provide multiple browser support, it is necessary to program a conditional settings of the “object” tag by nesting the tags for IE and for other browsers. An example is shown below with the tiny Julia applet (128 bytes) created by the russian programmer Konstantin Victorovich Morshnev (alias MoKo).
A detailed tutorial about (Multiple Browser Supported) Java applet using XHTML ‘object’ tag is given by Shayne Steele. A user guide to embed applets in documents with the “object” tag is published by Sun.