Webpage Workshop: Home » HTML language reference » Embedded object

Embedded object

This element is used to embed external objects within your document. It can be used for any type of media object, for example Flash, Java applets, ActiveX controls or images.

The object element can contain parameter elements to pass data to the object, and can also include other elements that are only displayed when no support for the particular object type is provided.

<object
    align="bottom | left | middle | right | top"**
    archive="url"
    border="percentage | pixels"**
    class="class name(s)"
    classid="identifier"
    codebase="url"
    codetype="MIME type"
    data="url"
    declare
    dir="ltr | rtl"
    height="percentage | pixels"
    hspace="percentage | pixels"**
    id="unique identifier"
    lang="language code"
    name="identifier"
    standby="text"
    style="style information"
    tabindex="number"
    title="text"
    type="MIME type"
    usemap="url"
    vspace="percentage | pixels"**
    width="percentage | pixles"
>
</object>

Key:
‡ = Required attribute
** = Transitional only

Explanation of attributes

align**: used to specify the position of the element in relation to content that might flow around it. The defined values are bottom, left, middle, right and top.

archive: this attribute contains the URL of an archive file that may be used to contain more than one object, for example a Java applet's JAR archive.

border**: used to specify the thickness of the border that surrounds the object.

class: used to state which class(es) the element belongs to. It is possible to indicate more than one class for an element by separating each class name with a space character. This attribute is normally used in combination with a stylesheet in order to associate the elements with particular styles defined within the stylesheet.

classid: this attribute contains a URL (or pseudo URL) that specifies the object's implementation method. The exact syntax of the URL depends on the object type that is being used. ActiveX controls do not use URLs, but rather a string of text identifying the type of control that it is, ie. CLSID: object-id.

codebase: used to specify a relative base (URL) that is used to access the object specified in the classid attribute. It is similar to the base URL element, in that is specifies the base URL from which to work.

codetype: this attribute specifies the MIME type of the object.

data: this attribute is used to specify a URL that contains data that is used by the object.

declare: used when declaring an object without actually instantiating it (ie. creating, but not displaying). This is used when the object is a parameter to another object, or when the object is instantiated by another control in the document.

dir: used to set the direction of the text in combination with the language set in the lang attribute. The available values are "ltr" (left to right) and "rtl" (right to left), with the default value being "ltr".

height: this attribute indicates the height, in pixels, that the object should be displayed at. Percentage values are also supported by most browsers, but this method of specifying height is unpredictable at best.

hspace**: used to specify the horizontal space between the object and its neighboring text.

id: used to specify a unique alphanumeric identifier to the element. This is usually used in combination with stylesheets in order to apply a style to one particular instance of an element. Only one element, regardless of type, can be given a particular id.

lang: used to indicate the language being used in the text contained within the element. The value of this attribute takes on the form of the ISO standard lanuage abbreviations found in RFC 3066. A list of these codes can be found on the ISO language codes page.

name: this attribute has differing definitions between browsers. Internet Explorer treats it as being the name of the object used in scripts, that is a similar meaning to the id attribute; but the standards state that it is similar to the meaning of the same named attribute in the input form control element, although no browsers support this definition of the attribute.

standby: this attribute is used to contain text that should be displayed while the object is loading.

style: used to specify an inline style to apply to the element. The styles defined here override the styles declared in the header section.

tabindex: used to define the elements position in the tabbing order of the document. This attribute contains a number, which a traversed in order by using the TAB key.

title: used to define an advisory text that may be displayed as a tooltip when a mouse is used to hover over the element.

type: this attribute specifies the MIME type of the data that is used by the object.

usemap: this indicates that the object is used as a client-side image map. The value of this attribute should match the value of the name attribute in the corresponding map element.

vspace**: used to specify the vertical space between the object and its neighboring text.

width: this attribute indicates the width, in pixels, that the object should be displayed at. Percentage values are also supported by most browsers, but this method of specifying width is unpredictable at best.

Event handlers

The following event handlers are defined for this element:

Compatibility

Description: Support of embedded object and attributes in various browsers
Test Internet Explorer 6+ Netscape 4 Mozilla and Netscape 6+ Opera 6+ MSN TV (WebTV) Konqeuror 3.0+
Basic element support  Yes  No  Yes  Yes  No 
Attribute: align  Yes  No  Yes  No  No 
Attribute: archive  No  No  Yes  No 
Attribute: border  Yes  No  Yes  Yes  No 
Attribute: class  Yes  No  Yes  Yes  No 
Attribute: classid  Yes  No  Yes  Yes  No 
Attribute: codebase  Yes  No  Yes  Yes  No 
Attribute: codetype  Yes  No  Yes  Yes  No 
Attribute: data  Yes  No  Yes  Yes  No 
Attribute: declare  No  No  No  No 
Attribute: dir  Yes  No  No  No  No 
Attribute: height  Yes  No  Yes  Yes  No 
Attribute: hspace  Yes  No  Yes  Yes  No 
Attribute: id  Yes  No  Yes  Yes  No 
Attribute: lang  Yes  No  Yes  Yes  No 
Attribute: name  Yes  No  Yes  Yes  No 
Attribute: standby  No  No  No  Yes  No 
Attribute: style  Yes  No  Yes  Yes  No 
Attribute: tabindex  Yes  No  No  No  No 
Attribute: title  Yes  No  Yes  Yes  No 
Attribute: type  Yes  No  Yes  Yes  No 
Attribute: usemap  No  No  Yes  Yes  No 
Attribute: vspace  Yes  No  Yes  Yes  No 
Attribute: width  Yes  No  Yes  Yes  No 

Key:
The browser icons are explained in the below list:
Internet Explorer 6+ = Microsoft Internet Explorer 6+
Netscape 4 = Netscape Communicator 4
Mozilla and Netscape 6+ = Mozilla and Netscape Navigator 6+
Opera 7+ = Opera 7+
MSN TV (WebTV) = MSN TV (aka. WebTV)
Konqeuror 3.0+ = Konqueror 3.0+