Tag <object> HTML Reference



Example

How to use the <object> element to embed a Flash file:

<object width="600" height="400" data="flash.swf"></object>

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

1. Definition and Usage

The <object> tag defines an embedded object within an HTML document. Use this element to embed multimedia (like audio, video, Java applets, ActiveX, PDF, and Flash) in your web pages.

You can also use the <object> tag to embed another webpage into your HTML document.

You can use the <param> tag to pass parameters to plugins that have been embedded with the <object> tag.


2. Differences Between HTML and XHTML

None


3. Optional Attributes

DTD indicates in which HTML 4.01/XHTML 1.0 DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

AttributeValueDescriptionDTD
aligntop
bottom
middle
left
right
Deprecated. Use styles instead.
Specifies the alignment of the <object> element according to surrounding elements
TF
archiveURLA space separated list of URL's to archives. The archives contains resources relevant to the objectSTF
borderpixelsDeprecated. Use styles instead.
Specifies the width of the border around an <object>
TF
classidclass_IDDefines a class ID value as set in the Windows Registry or a URLSTF
codebaseURLDefines where to find the code for the objectSTF
codetypeMIME_typeThe internet media type of the code referred to by the classid attributeSTF
dataURLSpecifies the URL of the resource to be used by the objectSTF
declaredeclareDefines that the object should only be declared, not created or instantiated until neededSTF
heightpixelsSpecifies the height of the objectSTF
hspacepixelsDeprecated. Use styles instead.
Specifies the whitespace on left and right side of an object
TF
namenameSpecifies a name for the objectSTF
standbytextDefines a text to display while the object is loadingSTF
typeMIME_typeSpecifies the MIME type of data specified in the data attributeSTF
usemap#mapnameSpecifies the name of a client-side image map to be used with the objectSTF
vspacepixelsDeprecated. Use styles instead.
Specifies the whitespace on top and bottom of an object
TF
widthpixelsSpecifies the width of the objectSTF

4. Standard Attributes

The <object> tag supports the following standard attributes:

AttributeValueDescriptionDTD
classclassnameSpecifies a classname for an elementSTF
dirrtl
ltr
Specifies the text direction for the content in an elementSTF
ididSpecifies a unique id for an elementSTF
langlanguage_codeSpecifies a language code for the content in an elementSTF
stylestyle_definitionSpecifies an inline style for an elementSTF
tabindexnumberSpecifies the tab order of an elementSTF
titletextSpecifies extra information about an elementSTF
xml:langlanguage_codeSpecifies a language code for the content in an element, in XHTML documentsSTF

5. Event Attributes

The <object> tag supports the following event attributes:

AttributeValueDescriptionDTD
onclickscriptScript to be run on a mouse clickSTF
ondblclickscriptScript to be run on a mouse double-clickSTF
onmousedownscriptScript to be run when mouse button is pressedSTF
onmousemovescriptScript to be run when mouse pointer movesSTF
onmouseoutscriptScript to be run when mouse pointer moves out of an elementSTF
onmouseoverscriptScript to be run when mouse pointer moves over an elementSTF
onmouseupscriptScript to be run when mouse button is releasedSTF
onkeydownscriptScript to be run when a key is pressedSTF
onkeypressscriptScript to be run when a key is pressed and releasedSTF
onkeyupscriptScript to be run when a key is releasedSTF

Relative articles