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