Easy Tutorial
❮ Att Output For Att Input Formtarget ❯

HTML <object> Tag

Example

Using the <object> element to add a Flash file to an HTML document:


Browser Support

Most browsers currently support the <object> tag.


Tag Definition and Usage

Defines an embedded object. Use this element to add multimedia to your XHTML pages. This element allows you to specify the data and parameters for an object inserted into an HTML document, as well as the code to display and manipulate the data.

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

The intention of the object was to replace the img and applet elements. However, due to vulnerabilities and lack of browser support, this has not been realized.

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

Fortunately, the object element provides a solution. If the object element is not displayed, the code between the <object> and </object> tags is executed. This way, we can nest multiple object elements (each for a different browser).


Differences Between HTML 4.01 and HTML5

Some HTML 4.01 attributes are not supported in HTML5.

"form" is a new attribute defined in HTML5.

In HTML5, objects can be submitted within form elements.

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


Attributes

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 to archive files containing 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 of the class in the Windows Registry or a URL, which can specify the location of the object in the browser, typically a Java class. | | codebase | URL | Not supported in HTML5. Defines the base URL for the code required by the object. | | 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 and cannot be created or instantiated until the object is applied. | | form New | form_id | Specifies one or more forms the object belongs to. | | height | pixels | Specifies the height of the object. | | hspace | pixels | Not supported in HTML5. Deprecated in HTML 4.01. Specifies the horizontal space to the left and right of the object. | | name | name | Specifies a name for the object. | | standby | text | Not supported in HTML5. Defines the text to be 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 a client-side image map to be used with the object. | | vspace | pixels | Not supported in HTML5. Deprecated in HTML 4.01. Specifies the vertical space above and below the object. | | width | pixels | Specifies the width of the object. |


Global Attributes

The <object> tag supports global attributes. See the complete list of HTML Global Attributes.


Event Attributes

The <object> tag supports all HTML event attributes.


Related Articles

HTML Tutorial: HTML Object Element

❮ Att Output For Att Input Formtarget ❯