HTML <object> Tag


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

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

Definition and Usage

Define 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 objects inserted in the HTML document, as well as the code that can be used to display and manipulate the data.

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

object was originally intended 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, mainstream browsers all use different code to load the same object type.

Fortunately, the object object provides a solution. If the object element is not displayed, execution is performed at <object> with </object> Between the codes. In this way, we are able to nest multiple object elements (one for each browser).

Browser Support

<object> Yes Yes Yes Yes Yes Yes

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 a form.

Objects no longer appear in HTML5 <head> Element area.


= New in HTML5.

attribute value description
align top bottom middle left right Not supported in HTML5. HTML 4.01 is obsolete. Regulations <object> The alignment of elements relative to surrounding elements.
archive URL Not supported in HTML5. A space-separated list of URLs to the archive file. These archives contain objects-related resources.
border pixels Not supported in HTML5. HTML 4.01 is obsolete. Regulations <object> The width of the surrounding border.
classid class_ID Not supported in HTML5. Defines the ID value of a class embedded in Windows Registry or in a URL. This attribute can be used to specify the location of objects contained in the browser, usually a Java class.
codebase URL Not supported in HTML5. Define where to find the code needed for the object, and provide 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 applied.
form New form_id Specifies the form or forms to which the object belongs.
height pixels Specifies the height of the object.
hspace pixels Not supported in HTML5. HTML 4.01 is obsolete. Specifies the margins 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 displayed when 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 image map to use with the object.
vspace pixels Not supported in HTML5. HTML 4.01 is obsolete. Specifies the top and bottom margins of an object.
width pixels specifies the width of the object.