21 out of 36 rated this helpful - Rate this topic

object element | object object

[This documentation is preliminary and is subject to change.]

Inserts an object into the HTML page.

Document Object Model (DOM) Level 2 HTML Specification, Section 1.6.5HTML 4.01 Specification, Section 13.3

Standards information

HTML information

Closing Tagrequired
CSS Displayinline

DOM Information

Inheritance Hierarchy

 Node
  Element
   HTMLElement
     object

Remarks

An object element can be a child of the head or the body element of a document.

Possible return values (those generated by Dynamic HTML (DHTML) Object Model properties) on the object element depend on the implementation of the object. For example, the readyState property returns null or error if the object does not implement a readyState property. DHTML Object Model properties available for an object depend on the content of the object. For information about supported properties, see the documentation for the individual object.

Events are sent directly to the object element. If the event is returned by the embedded object, it bubbles accordingly. If the event is not returned, it does not bubble.

Note  You can use the object property for the object element to reconcile DHTML Object Model members that are duplicated by the object element's implementation and by DHTML. For instance, if the object implements an item method and DHTML implements an item method, use document.all.objectID.object.item() to access the one defined for the object.

Windows Internet Explorer 9. In IE9 Standards mode, the object element is allowed to load content from other domains. In IE8 Standards mode, however, this is not allowed.

Windows Internet Explorer 8 and later. IE8 mode enables several enhancements to the object element that are not available when pages are displayed in earlier document modes.

  • Images are supported as native object types.

  • The values of the codeBase and data attributes depend on the current document compatibility mode.

  • Object fallback is supported when an object fails to load for communication or cross-domain security failures.

    Note  Object fallback does not occur when the contentEditable property of the document object is set to true.

  • The title attribute is preferred over the alt attribute when specified as a pop-up tooltip.

  • When the value of the data attribute specifies the data URI protocol, the value is not passed to Microsoft ActiveX controls upon instantiation. This preserves compatibility with older ActiveX controls that do not support the data URI protocol.

Examples

The following example uses the script element to define event handlers on the object element.


<SCRIPT FOR=oObject EVENT=eEvent>
:
</SCRIPT>
<OBJECT ID=oObject CLASSID="xyz.abc">
</OBJECT>

The following example illustrates that when an object fails to instantiate for any reason, the HTML inside the object element is rendered. This provides a convenient way to inform the user that the object failed to load.


<OBJECT CLASSID="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
<SPAN STYLE="color:red">ActiveX control failed to load! 
-- Please check browser security settings.</SPAN>
</OBJECT>

 

 

Build date: 3/8/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Display problems (more)
1. <OBJECT style=cursor:...> is overridden by <STYLE> BODY {cursor:...}

(Except the sliders are cursor:hand.)
Display problems
  1. White space following an OBJECT is ignored so you have to set the right margin to get an acceptable display.
  2. An OBJECT element within an A hyperlink is not visibly marked as a hyperlink.
anomaly - interaction - contenteditable
N.B. Operating the standalone Windows Media Player while using a contenteditable webpage that has its own Media Player object, freezes-out the contenteditable capability, temporarily.

(N.B. RELATED: Use of onmouseup popup, can cause contenteditable to belay action on its currently-selected element... REMEDY: Click on another element in the contenteditable.)
exceptions
An embedded Windows Media Player object does not fire onclick, onblur,...

REMEDY: onmouseup fires,...

Note also that its Play/Pause button activates on-or-after onmouseup.
No fallback with missing text file
OBJECT[type="text/plain";data="missing"] is equivalent to OBJECT[data="about:blank"]. This behaviour is incorrect; the object should not load and fallback content should be displayed instead.