<OBJECT>NN 4 IE 3 HTML 4  

<OBJECT>...</OBJECT>

HTML End Tag: Required  

The object element supplies the browser with information to load and render data types that are not natively supported by the browser. If the browser must load some external program (a Java applet, a plugin, or some other helper), the information about the content that is to be rendered is contained by the object element, its attributes, and optionally, associated param elements nested inside of it. Although today's browsers recognize elements such as applet and embed, the HTML specification indicates that the trend is to combine all of this into the object element.

The HTML 4 specification allows nesting of object elements to give the browser a chance to load alternate content if no plugin or other necessary content aids are available in the browser. Essentially, the browser should be able to walk through nested object elements until it finds one it can handle. For example, the outer object element may try to load an MPEG2 video; if no player is available, the browser looks for the next nested object, which is a JPEG still image from the video; if the browser is not a graphical browser, it would render some straight HTML that is the most nested item (although not as an object element) within the hierarchy of nested objects:

To determine which attributes apply to a particular content type or object and what their values look like, you have to rely on documentation from the supplier of the object or plugin. That same documentation should let you know whether the functionality is available across browser brands and operating systems.

 
Example
 
<OBJECT id="earth" classid="clsid:83A38BF0-B33A-A4FF-C619A82E891D">
<PARAM name="srcStart" value="images/earth0.gif">
<PARAM name="frameCount" value="12">
<PARAM name="loop" value="-1"
<PARAM name="fps" value="10">
</OBJECT>
 
Element-Specific Attributes
 
alignaltarchiveborderclassid
codecodebasecodetypedatadeclare
heighthspacenamestandbytype
usemapvspacewidth
 
Element-Specific Event Handler Attributes

None.

accesskeyNN 6 (see text) IE 4/5 HTML 4 (see text)  

accesskey="character"

Optional  

A single character key that either gives focus to an element (in some browsers) or activates a form control or link action. The browser and operating system determine if the user must press a modifier key (e.g., Ctrl, Alt, or Command) with the access key to activate the link. In Windows versions of IE 4 and later and Netscape 6, the Alt key is required and the key is not case-sensitive. For Macintosh versions of IE 5 and later and Netscape 6, the Ctrl modifier key is required to effect the action.

Although accesskey is listed here as a widely shared attribute, that isn't strictly the case across all implementations. HTML 4 and Netscape 6 recognize this attribute only for the following elements: a, area, button, input, label, legend, and textarea. To this list, IE 4 adds applet, body, div, embed, isindex, marquee, object, select, span, table, and td (but removes label and legend). IE 5 adds every other renderable element, but with a caution: except for input and other form-related elements, you must also assign a tabindex attribute to the IE 5 and later element (even if simply a value of zero for all) to let the accelerator key combination bring focus to the element.

 
Example
 
<A href="http://www.megacorp.com/toc.html" accesskey="t">Table of Contents</A>
		<H2 class="subsection" accesskey="2" tabindex="0">Part Two</H2>
 
Value

Single character of the document set.

 
Default

None.

 
Object Model Reference
 
[window.]document.links[i].accessKey
		[window.]document.anchors[i].accessKey
		[window.]document.formName.elementName.accessKey
		[window.]document.forms[i].elements[j].accessKey
		[window.]document.getElementById(elementID).accessKey
alignNN 4 IE 3 HTML 4  

align="alignmentConstant"

Optional  

Determines how the rectangle of the object element aligns within the context of surrounding content. See the discussion about alignment of elements with respect to content outside an element's box in the Section 8.1.5 earlier in this chapter.

 
Example
 
<OBJECT ... align="baseline"></OBJECT>
 
Value

Constant value. See Section 8.1.5.

 
Default

bottom

 
Object Model Reference
 
[window.]document.getElementById(elementID).align
archiveNN 6 IE 6 HTML 4  

archive="URIList"

Optional  

A space-delimited list of URIs of files that support the loading and running of the object element. By explicitly specifying the files in the archive attribute, the browser doesn't have to wait for the supporting files to be called by the content running in the object element. Instead, the supporting files can be downloaded simultaneously with the primary content. The archive attribute may also include URIs assigned to the classid or data attributes, but one of these two attributes still needs to point to the primary content URI. Version 6 browsers provide no particular functionality for this attribute.

 
Example
 
<OBJECT ... archive="/images/anim3.gif/images/anim4.gif"></OBJECT>
 
Value

A complete or relative URL.

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).archive
borderNN 6 IE 6 HTML 4  

border="pixels"

Optional  

The thickness of a border around the object element. The attribute is deprecated in HTML 4 in favor of style sheet borders. If you use the object element to load an image for a client-side image map, you can set the border attribute to zero to eliminate the typical link border in IE 5/Mac and Netscape 6 (see usemap later in this section).

 
Example
 
<OBJECT ... border="4"></OBJECT>
 
Value

Any integer pixel value.

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).bprder
classidNN 4 IE 3 HTML 4  

classid="URL"

Optional  

The URL of the object's implementation. This attribute typically directs the browser to load a program, an applet, or a plugin class file. In Internet Explorer, the URL can point to the CLSID directory that stores all of the IDs for registered ActiveX controls, such as DirectAnimation. You must obtain the classid value from the supplier of an ActiveX control (or root around the Registry with Regedit if you know what you're looking for). In Navigator 4, the Java Archive (JAR) Installation Manager attempts to install a plugin from the classid URL if the plugin is not installed for data specified in the data attribute. Eventually, this attribute may be used to load Java applets (IE 4 includes a code attribute to handle this now), but through Version 6 of both browsers, Java applets are not yet supported in this fashion.

 
Example
 
<OBJECT id="earth" classid="clsid:83A38BF0-B33A-A4FF-C619A82E891D"></OBJECT>
 
Value

A complete or relative URL.

 
Default

None.

 
Object Model Reference
 
[window.]document.elementID.classid
codeNN n/a IE 4 HTML n/a  

code="fileName.class"

Optional  

Internet Explorer uses the code attribute to allow the object element to perform the same job as an applet element, using the same kind of attributes. The code attribute value is the name of the Java applet class file. If the class file is in a directory other than the document, the path to the directory must be assigned to the codebase attribute, just like in the applet element. Parameters are passed to applets via param elements, just like the ones nested inside applet elements. IE appears to preserve the classid attribute for referencing ActiveX controls only.

 
Example
 
<OBJECT code="fileReader.class" codebase="classes"></OBJECT>
 
Value

Applet class filename.

 
Default

None.

 
Object Model Reference
 
[window.]document.elementID.code
codebaseNN 4 IE 3 HTML 4  

codebase="path"

Optional  

Path to the directory holding the class file designated in either the code or classid attribute. The codebase attribute does not name the class file, just the path. You can make this attribute a complete URL to the directory, but don't try to access a codebase outside of the domain of the current document.

 
Example
 
<OBJECT code="fileReader.class" codebase="classes"></OBJECT>
 
Value

Case-sensitive pathname, usually relative to the directory storing the current HTML document.

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).codeBase
codetypeNN 6 IE 3 HTML 4  

codetype="MIMEType"

Optional  

An advisory about the content type of the object referred to by the classid attribute. A browser might use this information to assist in preparing support for a resource requiring a multimedia player or plugin. If the codetype attribute is missing, the browser looks next for the type attribute setting (although it is normally associated with content linked by the data attribute URL). If both attributes are missing, the browser gets the content type information from the resource as it downloads.

 
Example
 
<OBJECT classid="clsid:83A38BF0-B33A-A4FF-C619A82E891D"
codetype="application/x-crossword"></OBJECT>
 
Value

Case-insensitive MIME type. A catalog of registered MIME types is available from ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/.

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).codeType
dataNN 4 IE 3 HTML 4  

data="URL"

Optional  

URL of a file containing data for the object element (as distinguished from the object itself). For data with a content type that can be opened (and viewed or played) with any compatible object or plugin, the data and type attributes are generally sufficient to launch the plugin and get the content loaded. But if the content requires a very specific plugin or ActiveX control, you should include a classid attribute that points to the object's implementation as well. In that case, you can specify the content type with either the codetype or type attributes. Relative URLs are calculated relative to the codebase attribute, if one is assigned; otherwise the URL is relative to the document's URL.

 
Example
 
<OBJECT data="proddemo.mpeg" type="application/mpeg"></OBJECT>
 
Value

A complete or relative URL.

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).data
declareNN 6 IE 6 HTML 4  

declare

Optional  

The presence of the declare attribute instructs the browser to regard the current object element as a declaration only, without instantiating the object. A browser may use this opportunity to precache data that does not require the object being loaded or run. Another object element pointing to the same classid and/or data attribute values, but without the declare attribute, gets the object running. Version 6 browsers provide no particular functionality for this attribute.

 
Example
 
<OBJECT classid="clsid:83A38BF0-B33A-A4FF-C619A82E891D" declare></OBJECT>
 
Value

The presence of the attribute sets it to true.

 
Default

false

 
Object Model Reference
 
[window.]document.getElementById(elementID).declare
height, widthNN 4 IE 3 HTML 4  

height="length" width="length"

Optional  

The size that an embedded object (or its plugin control panel) occupies in a document is governed by the height and width attribute settings. Some browser versions might allow you to get away without assigning these attributes and letting the plugin's own user interface design determine the height and width of its visible rectangle. It is best to specify the exact dimensions of a plugin's control panel or the data (in the case of images) whenever possible (control panels vary with each browser and even between different plugins for the same browser). In some cases, such as Navigator 4 for the Macintosh, the object may not display if you fail to supply enough height on the page. If you assign values that are larger than the actual object or its control panel, the browser reserves that empty space on the page, which could interfere with your intended page design.

When an object is scriptable, and you don't want its controller to appear, you can set its dimensions to zero or one. Place the tag at the end of the document.

 
Example
 
<OBJECT data="blues.aif" height="150" width="250"></OBJECT>
 
Value

Positive integer values (optionally quoted) or percentage values (quoted).

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).height
[window.]document.getElementById(elementID).width
hspace, vspaceNN 6 IE 3 HTML 4  

hspace="pixelCount" vspace="pixelCount"

Optional  

A margin that acts as whitespace padding around the visual content of the object element's rectangular space. hspace establishes a margin on the left and right sides of the rectangle; vspace establishes a margin on the top and bottom sides of the rectangle.

 
Example
 
<OBJECT data="blues.aif" height="150" width="250" vspace="10" hspace="10"></OBJECT>
 
Value

Integer representing the number of pixels for the width of the margin on the relevant sides of the object element's rectangle.

 
Default

0

 
Object Model Reference
 
[window.]document.getElementById(elementID).hspace
[window.]document.getElementById(elementID).vspace
langNN 3 IE 4 HTML 4  

lang="languageCode"

Optional  

The language being used for the element's attribute values and content. A browser can use this information to assist in proper rendering of content with respect to details such as treatment of ligatures (when supported by a particular font or required by a written language), quotation marks, and hyphenation. Other applications and search engines might use this information to aid the selection of spell-checking dictionaries and the creation of indices.

 
Example
 
<SPAN lang="de">Deutsche Bundesbahn</SPAN>
 
Value

Case-insensitive language code.

 
Default

Browser default.

 
Object Model Reference
 
[window.]document.getElementById(elementID).lang
nameNN 6 IE 6 HTML 4  

name="elementIdentifier"

Optional  

The HTML 4 specification provides for a name attribute of the object element for instances in which the object is part of a form that is submitted to the server. The name attribute in this case performs the same function as the name attribute of an input element; it acts as a label for some data being submitted. The code that is loaded into the object element must be programmed to return a value if it is to be submitted via an HTML form. Through Version 6, mainstream browsers list support for this attribute for compatibility claims, but do not respond to its value. Use the id attribute to assign an identifier that scripts use to reference the object.

 
Example
 
<OBJECT name="embedded" classid="clsid:83A38BF0-B33A-A4FF-C619A82E891D"
height="150" width="250"></OBJECT>
 
Value

Case-sensitive identifier.

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).name
standbyNN 6 IE 6 HTML 4  

standby="HTMLText"

Optional  

HTML content to be displayed while the object is loading. This attribute has not been implemented in Version 6 browsers (although it works in IE 5/Mac); presumably the message is to be displayed in the rectangular region intended for the object element, just as the alt message appears in an img element space while the image loads.

 
Example
 
<OBJECT classid="clsid:83A38BF0-B33A-A4FF-C619A82E891D"
height="150" width="250" standby="Loading movie..."></OBJECT>
 
Value

Any HTML content.

 
Default

None.

typeNN 4 IE 3 HTML 4  

type="MIMEType"

Required  

An advisory about the content type of the data referred to by the data attribute. A browser might use this information to assist in preparing support for a resource requiring a multimedia player or plugin. The data element first looks to the codetype attribute for this information. But if the codetype attribute is missing, the browser looks next for the type attribute setting. If both attributes are missing, the browser tries to get the content type information from the resource as it downloads. To be on the safe side, always specifiy a MIME type for image data (e.g., image/jpeg or image/gif).

 
Example
 
<OBJECT data="movies/prodDemo.mpeg" type="application/mpeg"></OBJECT>
 
Value

Case-insensitive MIME type. A catalog of registered MIME types is available from ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/.

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).type
tabindexNN 6 IE 4 HTML 4  

tabindex="integer"

Optional  

A number that indicates the sequence of this element within the tabbing order of all focusable elements in the document. Tabbing order follows a strict set of rules. Elements that have values other than zero assigned to their tabindex attributes are first in line when a user starts tabbing in a page. Focus starts with the element with the lowest tabindex value and proceeds in order to the highest value, regardless of physical location on the page or in the document. If two elements have the same tabindex values, the element that comes earlier in the document receives focus first. Next come all elements that either don't support the tabindex attribute or have the value set to zero. These elements receive focus in the order in which they appear in the document. Note that reloading the current page does not necessarily restart the tabbing sequence from the "top." Therefore, controlling tabbing sequence is most helpful when the logic of your focusable elements is something other than the source code order of those elements (e.g., directing tabbing to fields down table columns rather than across rows).

HTML 4 and Netscape 6 limit the tabindex attribute to the following elements: a, area, button, input, object, select, textarea. To this list, IE 4 adds applet, body, div, embed, isindex, marquee, span, table, and td. IE 5 adds every other renderable element. A negative value in IE (only) removes an element from tabbing order entirely.

Links and anchors cannot be tabbed to with the Mac version of IE 4, so the tabindex for a elements is ignored in that version.

 
Example
 
<A href="chapter3.html" tabindex="3">Chapter 3</A>
 
Value

Any integer from 0 through 32,767. In IE, setting tabindex to a negative value causes the element to be skipped in tabbing order altogether.

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).tabIndex
usemapNN 6 IE 6 HTML 4  

usemap="mapURL"

Optional  

The HTML 4 specification lists the usemap attribute for an object element, thus offering the possibility of using the object element to load an image that gets used as an image map. Version 6 browsers (and IE 5/Mac) provide this capability.

Assign the URI of the image to the data attribute, and assign a MIME type for the image to the type property. Create a separate map element with one or more nested area elements, and assign the map element's name identifier to the object element's usemap attribute. IE/Windows pads the image and adds scrollbars, so you may not achieve successful cross-browser deployment. Netscape 6 and IE 5/Mac essentially duplicate the traditional client-side image map functionality through the object element. They also display the typical link border around the image unless you also set the border attribute to zero.

 
Example
 
<OBJECT data="navbar.jpg" type="image/jpeg" alt="Navigation Bar" usemap="#navbarMap"
border="0"></OBJECT>
 
Value

See the usemap attribute of the img element.

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).useMap
vspace  

  

See hspace.

width  

  

See height.