--- title: HTMLObjectElement slug: Web/API/HTMLObjectElement tags: - API - HTML DOM - Interface - NeedsTranslation - Reference - TopicStub translation_of: Web/API/HTMLObjectElement --- <div> <div>{{ APIRef("HTML DOM") }}</div> </div> <p>The <strong><code>HTMLObjectElement</code></strong> interface provides special properties and methods (beyond those on the {{domxref("HTMLElement")}} interface it also has available to it by inheritance) for manipulating the layout and presentation of {{HTMLElement("object")}} element, representing external resources.</p> <p>{{InheritanceDiagram(600, 120)}}</p> <h2 id="Properties">Properties</h2> <p><em>Inherits properties from its parent, {{domxref("HTMLElement")}}.</em></p> <dl> <dt>{{domxref("HTMLObjectElement.align")}} {{obsolete_inline}}</dt> <dd>Is a {{domxref("DOMString")}} representing an enumerated property indicating alignment of the element's contents with respect to the surrounding context. The possible values are <code>"left"</code>, <code>"right"</code>, <code>"justify"</code>, and <code>"center"</code>.</dd> <dt>{{domxref("HTMLObjectElement.archive")}} {{obsolete_inline}}</dt> <dd>Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("archive", "object")}} HTML attribute, containing a list of archives for resources for this object.</dd> <dt>{{domxref("HTMLObjectElement.border")}} {{obsolete_inline}}</dt> <dd>Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("border", "object")}} HTML attribute, specifying the width of a border around the object.</dd> <dt>{{domxref("HTMLObjectElement.code")}} {{obsolete_inline}}</dt> <dd>Is a {{domxref("DOMString")}} representing the name of an applet class file, containing either the applet's subclass, or the path to get to the class, including the class file itself.</dd> <dt>{{domxref("HTMLObjectElement.codeBase")}} {{obsolete_inline}}</dt> <dd>Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("codebase", "object")}} HTML attribute, specifying the base path to use to resolve relative URIs.</dd> <dt>{{domxref("HTMLObjectElement.codeType")}} {{obsolete_inline}}</dt> <dd>Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("codetype", "object")}} HTML attribute, specifying the content type of the data.</dd> <dt>{{domxref("HTMLObjectElement.contentDocument")}} {{readonlyInline}}</dt> <dd>Returns a {{domxref("Document")}} representing the active document of the object element's nested browsing context, if any; otherwise <code>null</code>.</dd> <dt>{{domxref("HTMLObjectElement.contentWindow")}} {{readonlyInline}}</dt> <dd>Returns a {{domxref("WindowProxy")}} representing the window proxy of the object element's nested browsing context, if any; otherwise <code>null</code>.</dd> <dt>{{domxref("HTMLObjectElement.data")}}</dt> <dd>Returns a {{domxref("DOMString")}} that reflects the {{htmlattrxref("data", "object")}} HTML attribute, specifying the address of a resource's data.</dd> <dt>{{domxref("HTMLObjectElement.declare")}} {{obsolete_inline}}</dt> <dd>Is a {{jsxref("Boolean")}} that reflects the {{htmlattrxref("declare", "object")}} HTML attribute, indicating that this is a declaration, not an instantiation, of the object.</dd> <dt>{{domxref("HTMLObjectElement.form")}} {{readonlyInline}}</dt> <dd>Retuns a {{domxref("HTMLFormElement")}} representing the object element's form owner, or null if there isn't one.</dd> <dt>{{domxref("HTMLObjectElement.height")}}</dt> <dd>Returns a {{domxref("DOMString")}} that reflects the {{htmlattrxref("height", "object")}} HTML attribute, specifying the displayed height of the resource in CSS pixels.</dd> <dt>{{domxref("HTMLObjectElement.hspace")}} {{obsolete_inline}}</dt> <dd>Is a <code>long</code> representing the horizontal space in pixels around the control.</dd> <dt>{{domxref("HTMLObjectElement.name")}}</dt> <dd>Returns a {{domxref("DOMString")}} that reflects the {{htmlattrxref("name", "object")}} HTML attribute, specifying the name of the browsing context.</dd> <dt>{{domxref("HTMLObjectElement.standby")}} {{obsolete_inline}}</dt> <dd>Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("standby", "object")}} HTML attribute, specifying a message to display while the object loads.</dd> <dt>{{domxref("HTMLObjectElement.tabindex")}}</dt> <dd>Is a <code>long</code> representing the position of the element in the tabbing navigation order for the current document.</dd> <dt>{{domxref("HTMLObjectElement.type")}}</dt> <dd>Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("type", "object")}} HTML attribute, specifying the MIME type of the resource.</dd> <dt>{{domxref("HTMLObjectElement.typeMustMatch")}}</dt> <dd>Is a {{jsxref("Boolean")}} that reflects the {{htmlattrxref("typeMustMatch", "object")}} HTML attribute, indicating if the resource specified by {{htmlattrxref("data", "object")}} must only be played if it matches the {{htmlattrxref("type", "object")}} attribute.</dd> <dt>{{domxref("HTMLObjectElement.useMap")}}</dt> <dd>Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("usemap", "object")}} HTML attribute, specifying a {{HTMLElement("map")}} element to use.</dd> <dt>{{domxref("HTMLObjectElement.validationMessage")}} {{readonlyInline}}</dt> <dd>Returns a {{domxref("DOMString")}} representing a localized message that describes the validation constraints that the control does not satisfy (if any). This is the empty string if the control is not a candidate for constraint validation (<code>willValidate</code> is <code>false</code>), or it satisfies its constraints.</dd> <dt>{{domxref("HTMLObjectElement.validity")}} {{readonlyInline}}</dt> <dd>Returns a {{domxref("ValidityState")}} with the validity states that this element is in.</dd> <dt>{{domxref("HTMLObjectElement.vspace")}} {{obsolete_inline}}</dt> <dd>Is a <code>long</code> representing the horizontal space in pixels around the control.</dd> <dt>{{domxref("HTMLObjectElement.width")}}</dt> <dd>Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("width", "object")}} HTML attribute, specifying the displayed width of the resource in CSS pixels.</dd> <dt>{{domxref("HTMLObjectElement.willValidate")}} {{readonlyInline}}</dt> <dd>Returns a {{jsxref("Boolean")}} that indicates whether the element is a candidate for constraint validation. Always <code>false</code> for <code>HTMLObjectElement</code> objects.</dd> </dl> <h2 id="Methods">Methods</h2> <p><em>Inherits methods from its parent, {{domxref("HTMLElement")}}.</em></p> <dl> <dt>{{domxref("HTMLObjectElement.checkValidity()")}}</dt> <dd>Retuns a {{jsxref("Boolean")}} that always is <code>true</code>, because <code>object</code> objects are never candidates for constraint validation.</dd> <dt>{{domxref("HTMLObjectElement.setCustomValidity()")}}</dt> <dd>Sets a custom validity message for the element. If this message is not the empty string, then the element is suffering from a custom validity error, and does not validate.</dd> </dl> <h2 id="Specifications">Specifications</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> <tr> <td>{{SpecName('HTML WHATWG', "#htmlobjectelement", "HTMLObjectElement")}}</td> <td>{{Spec2('HTML WHATWG')}}</td> <td> </td> </tr> <tr> <td>{{SpecName('HTML5 W3C', "embedded-content-0.html#the-object-element", "HTMLObjectElement")}}</td> <td>{{Spec2('HTML5 W3C')}}</td> <td>The W3C specification is a latest of a previous version of {{SpecName("HTML WHATWG")}}<br> Technically, the property <code>tabindex</code> is now defined on {{domxref("HTMLElement")}}.<br> The following properties are now obsolete: <code>align</code>, <code>archive</code>, <code>border</code>, <code>code</code>, <code>codeBase</code>, <code>codeType</code>, <code>declare</code>, <code>hspace</code>, <code>standby</code>, and <code>vspace</code>.<br> The following properties have been added: <code>typeMustMatch</code>, <code>contentWindow</code>, <code>willValidate</code>, <code>validity</code>, and <code>validationMessage</code>.<br> The following methods have been added: <code>checkValidity()</code> and <code>setCustomValidity()</code>.</td> </tr> <tr> <td>{{SpecName('DOM2 HTML', 'html.html#ID-9893177', 'HTMLObjectElement')}}</td> <td>{{Spec2('DOM2 HTML')}}</td> <td>The <code>contentDocument</code> property has been added.</td> </tr> <tr> <td>{{SpecName('DOM1', 'level-one-html.html#ID-9893177', 'HTMLObjectElement')}}</td> <td>{{Spec2('DOM1')}}</td> <td>Initial definition.</td> </tr> </tbody> </table> <h2 id="Browser_compatibility">Browser compatibility</h2> <p>{{Compat("api.HTMLObjectElement")}}</p> <h2 id="See_also">See also</h2> <ul> <li>The HTML element implementing this interface: {{HTMLElement("object")}}</li> </ul>