HTML <object>Tag


Examples

Use the <object> element to add Flash files in HTML:

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

Try it Yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

Most current browsers support the <object> tag.


Tag Definition and Usage Instructions

Defines an embedded object. Use this element to add multimedia to your XHTML page. This element allows you to specify the data and parameters of the object inserted into the HTML document, as well as the code that can be used to display and manipulate the data.

The <object> tag is used to contain objects such as images, audio, video, Java applets, ActiveX, PDF, and Flash.

The original intent of object was to replace the img and applet elements. However, this was not achieved due to vulnerabilities and lack of browser support.

Browser object support depends on the object type. Unfortunately, major browsers use different code to load the same object type.

Fortunately, the object element provides a solution. If the object element is not displayed, the code between <object> and </object> will be executed. In this way, we can nest multiple object elements (each corresponding to one browser).


Differences Between HTML 4.01 and HTML5

Some HTML 4.01 attributes are not supported in HTML5.

"form" is a new attribute defined by HTML5.

In HTML5, objects can be submitted in forms.

In HTML5, objects no longer appear within the <head> element area.


Attributes

New: New in HTML5.

Attribute Value Description
align top bottom middle left right Not supported in HTML5. Deprecated in HTML 4.01.Specifies the alignment of the <object> element relative to surrounding elements.
archive URL Not supported in HTML5.A space-separated list of URLs pointing to archive files. These archive files contain resources related to the object.
border pixels Not supported in HTML5. Deprecated in HTML 4.01.Specifies the border width around the <object>.
classid class_ID Not supported in HTML5.Defines the ID value of a class embedded in the Windows Registry or in a URL. This attribute can be used to specify the location of the object contained in the browser, usually a Java class.
codebase URL Not supported in HTML5.Defines where the code required by the object can be found, providing a base URL.
codetype MIME_type Not supported in HTML5.The MIME type of the code referenced by the classid attribute.
data URL Specifies the URL of the resource used by the object.
declare declare Not supported in HTML5.Defines that the object can only be declared, but cannot be created or instantiated, until the object is used.
formNew form_id Specifies one or more forms to which the object belongs.
height pixels Specifies the height of the object.
hspace pixels Not supported in HTML5. Deprecated in HTML 4.01.Specifies the whitespace on the left and right sides of the object.
name name Specifies a name for the object.
standby text Not supported in HTML5.Defines the text displayed while the object is loading.
type MIME_type Specifies the MIME type of the data specified in the data attribute.
usemap #mapname Specifies the name of the client-side image map used with the object.
vspace pixels Not supported in HTML5. Deprecated in HTML 4.01.Specifies the whitespace at the top and bottom of the object.
width pixels Specifies the width of the object.


Global Attributes

The <object> tag supports global attributes. View the complete attribute table.HTML Global Attributes。


Event Attributes

The <object> tag supports allHTML Event Attributes。


Related Articles

HTML Tutorial:HTML Object Element

Other Extensions