Description of the OBJECT element of the HTML 4.0 draft

Jukka Korpela, the author of Learning HTML 3.2 by Examples

This document describes the OBJECT element as defined in the HTML 4.0 draft. Being a working draft, it may change at any time, and such changes may not be reflected in this document. Please do not assume that Web browsers support the features described herein, even if they are announced as having OBJECT support.

Contents

Preface

The purpose of this document is to present the OBJECT element as proposed in the HTML 4.0 draft (in section Objects, Images, and Applets) in order to assist in understanding the content of the proposal in this respect. This is hopefully of some use when discussing the draft as well as mental preparation for authoring in HTML 4.0, assuming that the draft will be approved. Moreover, this document might form the basis for a tutorial on the OBJECT element if and when the draft will be approved and supported.

Thus, this document tries to be descriptive. I have written separate criticism of the HTML 4.0 draft which includes critical remarks on the OBJECT element, too, although it comments that element as one of the most important things in the draft.

The reader is assumed to know the basics of the HTML language, as described in my Getting Started with HTML or some of the other primers on HTML. No specific knowledge about some particular HTML version is required, but for some details which relate to the HTML 4.0 draft as a whole, the reader should consult that draft.

Background: OBJECT as generalization of IMG

From the early days of the Web, it has been possible to embed an image into a Web page. For instance, an early draft for HTML from June 1993 already described an IMG element with three attributes: SRC for specifying where the image file is, ALIGN for affecting the positioning of the image, and ALT for giving an alternative text to be used for display in text-only environments.

Later various optional attributes have been added to the definition of the IMG element. See, for example, a description of the IMG element as defined in HTML 3.2. However, these additions mainly relate to details of the presentation of images, although some additions have been made in order to support image maps.

On the other hand, images are just one form of illustration which people wish to use on Web pages. Animations, videos, and sounds would often be more useful than static images. (It is possible to use a simple IMG element for a graphics file which effectively looks like a short animation, but this feature isn't very powerful.)

The (hyper)link concept and the related A element has always been available in HTML for referring to various illustrations implemented in different media. For example, a hyperlink might provide an easy way to the reader to request (typically with a mouse click) a song to the played or a video shown, provided of course that suitable devices and software are available, installed and enabled. This simple facility should not be underestimated. One might well argue that most advanced illustrations should be implemented that way, allowing each reader to select what he wants to see or hear. However, the HTML 4.0 draft presumes that there are occasions where it makes sense to embed e.g. sounds or animations onto a Web page - or that authors will do that anyway.

In various nonstandard versions of the HTML language, such as the dialects supported by Internet Explorer or Netscape, there are different methods for embedding different media types onto a Web page, such as EMBED or BGSOUND for sounds. Moreover, some of such methods were taken into the HTML 3.2 standard: APPLET element for using Java applets and SCRIPT element for using client-side scripts. Both of these can be used to include animations onto Web pages, for example.

One of the aims of proposing the OBJECT element is to provide a more general facility. A simple IMG element like

<IMG SRC="decor.gif" ALT="">
could be replaced by
<OBJECT TYPE="image/gif" DATA="decor.gif"></OBJECT>
But as you may guess, the TYPE attribute might contain some other media type than an image type, for example an audio or video type. Moreover, the OBJECT element provides a method for specifying alternative presentations much more powerfully than using the simple ALT attribute (with plain text as value) in the IMG element. Using OBJECT, there can be several alternative presentations specified using various media types or using text with normal HTML markup.

A thematic description of all attributes of OBJECT

The following table explains the basic properties of all possible attributes of the OBJECT element. The attributes are divided into sections as follows:
element-specific attributes
Attributes which relate to the fundamental meaning of the OBJECT element. Some other elements may have attributes with the same names, but their meaning may vary. These attributes can be divided into two subsections:
special attributes
Attributes which relate to some special use of the element or to using it in conjunction with another element in the HTML language. These attributes can be divided into three subsections:
presentational attributes
Attributes which specify presentation properties such as alignment of dimensions. Deprecated in favor of style sheets.
general attributes
Attributes which can be attached to a wide range of elements in the HTML language, with the same basic meaning in each. These attributes can be divided into two subsections:
The table specifies, for each attribute,
Attributes of OBJECT
Element-specific attributes
Attributes related to the object itself
TYPE media type (Internet content type) for the data as defined in RFC 2045 the resource to which the DATA attribute refers should be of this type
DATA address of the data to be rendered URL, as defined in RFC 1738 and RFC 1808  
STANDBY message which can be displayed while loading the object's implementation and data a string (which may contain escape sequences) may help the user understand what's happening
Attributes related to the rendering mechanism
CLASSID address of the implementation (rendering meachanism) URL, as defined in RFC 1738 and RFC 1808 some nonstandard URLs, beginning e.g. with java: or clsid:, can be used, too
CODEBASE the base path for resolving the value of CLASSID when it is a relative URL URL, as defined in RFC 1738 and RFC 1808 default is base URL of the document
CODETYPE the media type of data expected by the program specified by CLASSID as defined in RFC 2045 default is the value of the TYPE attribute
DECLARE specifies that this OBJECT element is only a declaration DECLARE DECLARE=DECLARE can be written simply as DECLARE
Special attributes
Attributes related to applets
ARCHIVE names of archives containing classes and other resources to be preloaded comma-separated list of names the classes are loaded using an instance of an AppletClassLoader with the given codebase
Attributes related to image maps
USEMAP address of a client-side image map URL, as defined in RFC 1738 and RFC 1808 used when the included object is an image which is to act as a "clickable map"
SHAPES indicates that the OBJECT contains special links which turn the image object into a "clickable map" SHAPES SHAPES=SHAPES can be abbreviated as SHAPES
Attributes related to forms
NAME name for the object when submitted as part of a form a string  
TABINDEX position of current element in tabbing order an integer  
Presentational attributes
ALIGN vertical or horizontal alignment BOTTOM bottom of the object is vertically aligned with current baseline
MIDDLE center of the object is vertically aligned with current baseline
TOP top of the object is vertically aligned with top of current text line
LEFT the object floats to the left margin
RIGHT the object floats to the right margin
HEIGHT height of presentation area length specification  
WIDTH width of presentation area length specification  
BORDER width of border around of presentation area length specification default value depends on browser
HSPACE width of empty space to the left and right of presentation area length specification default value depends on browser
VSPACE width of empty space above and below the presentation area length specification default value depends on browser
General attributes
Core attributes
ID identifier for the element instance identifier (name) must be unique document-wide
CLASS class(es) for the document space-separated list of classes  
STYLE style specification for the element instance style declaration must be written in default style sheet language
TITLE advisory title for the element instance string  
Attributes for natural language support ("internationalization")
LANG language used within the element instance language code according to RFC 1766  
DIR base directionality of neutral text within the element instance LTR left to right
TRL right to left
Attributes for event handling
ONCLICK event handler for "mouse clicked" a script in the default scripting language  
ONDBLCLICK event handler for "mouse double clicked"
ONMOUSEDOWN event handler for "mouse button pressed down"
ONMOUSEUP event handler for "mouse button released"
ONMOUSEOVER event handler for "cursor moved onto the element"
ONMOUSEMOVE event handler for "cursor moved within the element"
ONMOUSEOUT event handler for "cursor moved away from the element"
ONKEYPRESSED event handler for "a key pressed and released over the element"
ONKEYDOWN event handler for "a key pressed down over the element"
ONKEYUP event handler for "a key released over the element"

A length specification can be given either as an absolute number of pixels or as a percentage such as "50%". The HTML 4.0 draft says in a comment in the DTD that the length specifications are suggested heights, widths, etc. On the other hand, the longer descriptions of the attributes do not refer to suggesting anything. They even say that the HEIGHT and WIDTH attributes "tell user agents to override the natural image size and scale the image to this width and height".


Jukka Korpela,
1997-10-09