HTML <object> Tag

The HTML <object> tag represents an embedded object in an HTML document.

Depending on the type of the resource, the <object> element will either be treated as an image, as a nested browsing context, or as an external resource to be processed by a plugin.

You can use the <param> tag to pass parameters to plugins that have been embedded using the <object> tag.

You can also use the <object> tag to embed another webpage into your HTML document.


The <object> tag is written as <object></object> with any contents enclosed between the start and end tags.

The <object> tag will usually have one or more attributes, such as the type attribute, or data attribute which determine the type of embedded content and any data that is required.

Like this:

The <object> tag can also have width and height attributes to determine the object's width and/or height.

Like this:


Embed Movie

Here, we use the <object> element to embed a Quicktime movie into the web page.

Embed Another Webpage

You can use the <object> element to insert another webpage within your document (this creates a nested browsing context).

Using the <param> Element

You can use the <param> element to pass parameters to your embedded objects.

Here, we use the <object> tag to embed a music file, and the <param> element to pass parameters to the <object> element. We tell it not to display audio controls (name="controller" value="true") and to start playing automatically (i.e. name="autoplay" value="false).


Attributes can be added to an HTML element to provide more information about how the element should appear or behave.

There are 3 kinds of attributes that you can add to your HTML tags: Element-specific, global, and event handler content attributes.

The <object> element accepts the following attributes.

Element-Specific Attributes

This table shows the attributes that are specific to the <object> tag/element.

dataSpecifies the location of data to be used by the object. The value must be a valid URL.
typeSpecifies the object type as specified in the data attribute. Must be a valid MIME type.
typemustmatchThis attribute is used in order to to make it safer for authors to embed untrusted resources where they expect a certain content type. The attribute specifies that the resource specified by the data attribute is only to be used if the value of the type attribute and the Content-Type of the aforementioned resource match.

The typemustmatch attribute must only be used when both the type and data is also being used.

The typemustmatch is a boolean attribute. If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace (i.e. either typemustmatch or typemustmatch="typemustmatch")..

Possible values:

  • [Empty String]
  • typemustmatch
nameAssigns the name of the object.
usemapSpecifies the name of an image map to use on this object.
formSpecifies the ID of a form to which this object belongs.

Possible values:

[The ID of a form element in the element's owner Document]

widthSpecifies the width, in pixels, to display the external content.

Possible values:

[Non-negative integer] (for example, 300)

heightSpecifies the height, in pixels, to display the external content.

Possible values:

[Non-negative integer] (for example, 150)

Global Attributes

The following attributes are standard across all HTML5 elements. Therefore, you can use these attributes with the <object> tag , as well as with all other HTML tags.

For a full explanation of these attributes, see HTML 5 global attributes.

Event Handler Content Attributes

Event handler content attributes enable you to invoke a script from within your HTML. The script is invoked when a certain "event" occurs. Each event handler content attribute deals with a different event.

Below are the standard HTML5 event handler content attributes.

Again, you can use any of these with the <object> element, as well as any other HTML5 element.

For a full explanation of these attributes, see HTML 5 event handler content attributes.

Differences Between HTML 4 & HTML 5

HTML5 introduced the following attributes:

HTML5 does not support the following attributes, which were supported in HTML 4:

Also, HTML 4 explicitly stated that the <object> element could appear within a document's <head> element, however, HTML5 does not state this. HTML5 states that the <object> element can appear anywhere that "embedded content" is expected.

To see more detail on the two versions see HTML5 <object> Tag and HTML4 <object> Tag. Also check out the links to the official specifications below.


Here's a template for the <object> tag with all available attributes for the tag (based on HTML5). These are grouped into attribute types, each type separated by a space. In many cases, you will probably only need one or two (if any) attributes. Simply remove the attributes you don't need.

For more information on attributes for this tag, see HTML5 <object> Tag and HTML4 <object> Tag.

Tag Details

For more details about the <object> tag, see HTML5 <object> Tag and HTML4 <object> Tag.


Here are the official specifications for the <object> element.

What's the Difference?

W3C creates "snapshot" specifications that don't change once defined. So the HTML5 specification won't change once it becomes an official recommendation. WHATWG on the other hand, develops a "living standard" that is updated on a regular basis. In general, you will probably find that the HTML living standard will be more closely aligned to the current W3C draft than to the HTML5 specification.