<object>


HTML <object> Tag

Instance

<html>
<body>

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

Run Example»

Click the "Run Instance" button to view the online instance


Browser support

1000.png

Most browsers currently support the <object> tag.


Tag definition and usage instructions

Define an embedded object. Please use this element to add multimedia to your XHTML pages. This element allows you to specify data and parameters for objects inserted into an HTML document, as well as code that can be used to display and manipulate the data.

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

Object was originally intended to replace img and applet elements. However, this did not happen due to bugs and lack of browser support.

The browser's object support depends on the object type. Unfortunately, major browsers all use different code to load the same object types.

Fortunately, the object object provides a solution. If the object element is not shown, the code between <object> and </object> is executed. This way we can nest multiple object elements (one for each 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 the form.

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


Attributes

New: HTML5 new attributes.

codebasecodetype##HTML5 is not supported. dataURLdeclareHTML5 is not supported. formNewform_idheightpixelshspacepixelsHTML5 Not supported. HTML 4.01 is deprecated. namenamestandbytextHTML5 is not supported. typeMIME_typeusemap#mapnamevspacepixelsHTML5 Not supported. HTML 4.01 is deprecated. widthpixels

Global attributes

<p> tag supports global attributes, see the complete attribute table HTML global attributes.


Event attributes

<p> tag supports all HTML event attributes.


Related Articles

HTML Tutorial: HTML Object Element


AttributesValueDescription
aligntop bottom middle left rightHTML5 is not supported. HTML 4.01 is deprecated. Specifies the alignment of the <object> element relative to surrounding elements.
archiveURLHTML5 Not supported. A space-separated list of URLs pointing to archive files. These archive files contain the resources associated with the object.
borderpixelsHTML5 Not supported. HTML 4.01 is deprecated. Specifies the border width around <object>.
classidclass_ID##HTML5 Not supported. 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 an object contained in the browser, usually a Java class.
URLHTML5 Not supported. Code required to define where the object can be found, providing a base URL.
MIME_typeThe MIME type of the code referenced through the classid attribute.
Specifies the URL of the resource used by the object.
declareDefinition The object can only be declared, but cannot be created or instantiated until the object is applied.
Specifies one or more forms to which the object belongs.
Specifies the height of the object.
Specifies the white space on the left and right sides of the object.
Specifies the name for the object.
Define the text displayed when the object is loading.
Specifies the MIME type of the data specified in the data attribute.
Specifies the name of the client image map to be used with the object.
Specifies the top and bottom margins of the object.
Specifies the width of the object.