<object>

  • Revision slug: Web/HTML/Element/object
  • Revision title: <object>
  • Revision id: 471211
  • Created:
  • Creator: Vikrant_patel
  • Is current revision? No
  • Comment

Revision Content

Summary

The HTML <object> Element (or HTML Embedded Object Element) represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin.

Attributes

This element includes the global attributes.

{{htmlattrdef("archive")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}
A space-separated list of URIs for archives of resources for the object.
{{htmlattrdef("border")}} {{deprecatedGeneric('inline','HTML4.01')}}; {{obsoleteGeneric('inline','HTML5')}}
The width of a border around the control, in pixels.
{{htmlattrdef("classid")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}
The URI of the object's implementation. It can be used together with, or in place of, the data attribute.
{{htmlattrdef("codebase")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}
The base path used to resolve relative URIs specified by classid, data, or archive. If not specified, the default is the base URI of the current document.
{{htmlattrdef("codetype")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}
The content type of the data specified by classid.
{{htmlattrdef("data")}}
The address of the resource as a valid URL. At least one of data and type must be defined.
{{htmlattrdef("declare")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}
The presence of this Boolean attribute makes this element a declaration only. The object must be instantiated by a subsequent <object> element. In HTML5, repeat the <object> element completely each that that the resource is reused.
{{htmlattrdef("form")}} {{HTMLVersionInline(5)}}
The form element, if any, that the object element is associated with (its form owner). The value of the attribute must be an ID of a {{HTMLElement("form")}} element in the same document.
{{htmlattrdef("height")}}
The height of the displayed resource, in CSS pixels.
{{htmlattrdef("name")}}
The name of valid browsing context (HTML5), or the name of the control (HTML 4).
{{htmlattrdef("standby")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}
A message that the browser can show while loading the object's implementation and data.
{{htmlattrdef("tabindex")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}
The position of the element in the tabbing navigation order for the current document.
{{htmlattrdef("type")}}
The MIME type of the resource specified by data. At least one of data and type must be defined.
{{htmlattrdef("usemap")}}
A hash-name reference to a {{HTMLElement("map")}} element; that is a '#' followed by the value of a {{htmlattrxref("name", "map")}} of a map element.
{{htmlattrdef("width")}}
The width of the display resource, in CSS pixels.

Examples

<!-- Embed a flash movie -->
<object data="move.swf" type="application/x-shockwave-flash"></object>

<!-- Embed a flash movie with parameters -->
<object data="move.swf" type="application/x-shockwave-flash">
  <param name="foo" value="bar">
</object> 

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', 'the-iframe-element.html#the-object-element', '<object>')}} {{Spec2('HTML WHATWG')}}  
{{SpecName('HTML5 W3C', 'the-object-element.html#the-object-element', '<object>')}} {{Spec2('HTML5 W3C')}}  
{{SpecName('HTML4.01', 'objects.html#h-13.3', '<object>')}} {{Spec2('HTML4.01')}}  

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatVersionUnknown}} {{CompatGeckoDesktop("1.0")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatGeckoMobile("1.0")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}

See also

  • {{HTMLElement("param")}}

{{HTML:Element_Navigation}}

Revision Source

<h2 id="Summary">Summary</h2>
<p>The <strong>HTML <code>&lt;object&gt;</code> Element</strong> (or <em>HTML Embedded Object Element</em>) represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin.</p>
<ul class="htmlelt">
  <li><dfn><a href="/en-US/docs/HTML/Content_categories" title="HTML/Content_categories">Content categories</a></dfn> <a href="/en-US/docs/HTML/Content_categories#Flow_content" title="HTML/Content categories#Flow content">Flow content</a>; <a href="/en-US/docs/HTML/Content_categories#Phrasing_content" title="HTML/Content categories#Phrasing content">phrasing content</a>; <a href="/en-US/docs/HTML/Content_categories#Embedded_content" title="HTML/Content categories#Embedded content">embedded content</a>, palpable content; if the element has a <strong>usemap</strong> attribute, <a href="/en-US/docs/HTML/Content_categories#Interactive_content" title="HTML/Content categories#Interactive content">interactive content</a>; <a href="/en-US/docs/HTML/Content_categories#Form_listed" title="HTML/Content categories#Form listed">listed</a>, <a href="/en-US/docs/HTML/Content_categories#Form_submittable" title="HTML/Content categories#Form submittable">submittable</a>&nbsp;<a href="/en-US/docs/HTML/Content_categories#Form-associated_content" title="HTML/Content categories#Form-associated content">form-associated</a> element.</li>
  <li><dfn>Permitted content</dfn> zero or more {{HTMLElement("param")}} elements, then <a href="/en-US/docs/HTML/Content_categories#Transparent_content_models" title="HTML/Content categories#Transparent content models">Transparent content</a>.</li>
  <li><dfn>Tag omission</dfn> {{no_tag_omission}}</li>
  <li><dfn>Permitted parent elements</dfn> Any element that accepts <a href="/en-US/docs/HTML/Content_categories#Embedded_content" title="HTML/Content categories#Embedded content">embedded content</a>.</li>
  <li><dfn>DOM interface</dfn> {{domxref("HTMLObjectElement")}}</li>
</ul>
<h2 id="Attributes">Attributes</h2>
<p><span style="line-height: 21px;">This element includes the&nbsp;</span><a href="https://developer.mozilla.org/en-US/docs/HTML/Global_attributes" style="line-height: 21px;" title="HTML/Global attributes">global attributes</a><span style="line-height: 21px;">.</span></p>
<dl>
  <dt>
    {{htmlattrdef("archive")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}</dt>
  <dd>
    A space-separated list of URIs for archives of resources for the object.</dd>
  <dt>
    {{htmlattrdef("border")}} {{deprecatedGeneric('inline','HTML4.01')}}; {{obsoleteGeneric('inline','HTML5')}}</dt>
  <dd>
    The width of a border around the control, in pixels.</dd>
  <dt>
    {{htmlattrdef("classid")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}</dt>
  <dd>
    The URI of the object's implementation. It can be used together with, or in place of, the <strong>data</strong> attribute.</dd>
  <dt>
    {{htmlattrdef("codebase")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}</dt>
  <dd>
    The base path used to resolve relative URIs specified by <strong>classid</strong>, <strong>data</strong>, or <strong>archive</strong>. If not specified, the default is the base URI of the current document.</dd>
  <dt>
    {{htmlattrdef("codetype")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}</dt>
  <dd>
    The content type of the data specified by <strong>classid</strong>.</dd>
  <dt>
    {{htmlattrdef("data")}}</dt>
  <dd>
    The address of the resource as a valid URL. At least one of <strong>data</strong> and <strong>type</strong> must be defined.</dd>
  <dt>
    {{htmlattrdef("declare")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}</dt>
  <dd>
    The presence of this Boolean attribute makes this element a declaration only. The object must be instantiated by a subsequent <code>&lt;object&gt;</code> element. In HTML5, repeat the &lt;object&gt; element completely each that that the resource is reused.</dd>
  <dt>
    {{htmlattrdef("form")}} {{HTMLVersionInline(5)}}</dt>
  <dd>
    The form element, if any, that the object element is associated with (its <em>form owner</em>). The value of the attribute must be an ID of a {{HTMLElement("form")}} element in the same document.</dd>
  <dt>
    {{htmlattrdef("height")}}</dt>
  <dd>
    The height of the displayed resource, in CSS pixels.</dd>
  <dt>
    {{htmlattrdef("name")}}</dt>
  <dd>
    The name of valid browsing context (HTML5), or the name of the control (HTML 4).</dd>
  <dt>
    {{htmlattrdef("standby")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}</dt>
  <dd>
    A message that the browser can show while loading the object's implementation and data.</dd>
  <dt>
    {{htmlattrdef("tabindex")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}</dt>
  <dd>
    The position of the element in the tabbing navigation order for the current document.</dd>
  <dt>
    {{htmlattrdef("type")}}</dt>
  <dd>
    The MIME type of the resource specified by <strong>data</strong>. At least one of <strong>data</strong> and <strong>type</strong> must be defined.</dd>
  <dt>
    {{htmlattrdef("usemap")}}</dt>
  <dd>
    A hash-name reference to a {{HTMLElement("map")}} element; that is a '#' followed by the value of a {{htmlattrxref("name", "map")}} of a map element.</dd>
  <dt>
    {{htmlattrdef("width")}}</dt>
  <dd>
    The width of the display resource, in CSS pixels.</dd>
</dl>
<h2 id="Examples">Examples</h2>
<pre class="brush: html">
&lt;!-- Embed a flash movie --&gt;
&lt;object data="move.swf" type="application/x-shockwave-flash"&gt;&lt;/object&gt;

&lt;!-- Embed a flash movie with parameters --&gt;
&lt;object data="move.swf" type="application/x-shockwave-flash"&gt;
  &lt;param name="foo" value="bar"&gt;
&lt;/object&gt; 
</pre>
<h2 id="Specifications" name="Specifications">Specifications</h2>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{SpecName('HTML WHATWG', 'the-iframe-element.html#the-object-element', '&lt;object&gt;')}}</td>
      <td>{{Spec2('HTML WHATWG')}}</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>{{SpecName('HTML5 W3C', 'the-object-element.html#the-object-element', '&lt;object&gt;')}}</td>
      <td>{{Spec2('HTML5 W3C')}}</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>{{SpecName('HTML4.01', 'objects.html#h-13.3', '&lt;object&gt;')}}</td>
      <td>{{Spec2('HTML4.01')}}</td>
      <td>&nbsp;</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatGeckoDesktop("1.0")}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Mobile</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatGeckoMobile("1.0")}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
  <li>{{HTMLElement("param")}}</li>
</ul>
<p>{{HTML:Element_Navigation}}</p>
Revert to this revision