<object>
The <object> element represents an external resource such as a PDF or SVG document. It was historically used for plugins such as Shockwave Flash. It is most useful when native HTML semantics or browser capabilities can replace custom implementation work.
Overview
The <object> element represents an external resource such as a PDF or SVG document. It was historically used for plugins such as Shockwave Flash. It is most useful when native HTML semantics or browser capabilities can replace custom implementation work.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 1 | 12 | 1 | 3 | 18 | 2 | |
| HTML attribute | ||||||
data | 1 | 12 | 1 | 3 | 18 | 2 |
| The form HTML attribute associates a form-associated element with a form element within the same document. This attribute applies to the button, fieldset, input, object, output, select, and textarea elements. | 1 | 12 | 1 | 3 | 18 | 2 |
height | 1 | 12 | 1 | 3 | 18 | 2 |
name | 1 | 12 | 1 | 3 | 18 | 2 |
type | 1 | 12 | 1 | 3 | 18 | 2 |
width | 1 | 12 | 1 | 3 | 18 | 2 |
| DOM API | ||||||
| The HTMLObjectElement interface provides special properties and methods (beyond those on the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of object element, representing external resources. | 1 | 12 | 1 | 3 | 18 | 1 |
| The contentDocument read-only property of the HTMLObjectElement interface Returns a Document representing the active document of the object element's nested browsing context, if any; otherwise null. | 1 | 12 | 1 | 3 | 18 | 1 |
| The contentWindow read-only property of the HTMLObjectElement interface returns a WindowProxy representing the window proxy of the object element's nested browsing context, if any; otherwise null. | 53 | 17 | 22 | 13 | 53 | 13 |
| The data property of the HTMLObjectElement interface returns a string that reflects the data HTML attribute, specifying the address of a resource's data. | 1 | 12 | 1 | 3 | 18 | 1 |
| The form read-only property of the HTMLObjectElement interface returns an HTMLFormElement object that owns this object, or null if this object element is not owned by any form. | 1 | 12 | 1 | 3 | 18 | 1 |
| The getSVGDocument() method of the HTMLObjectElement interface returns the Document object of the embedded SVG. | 1 | 12 | 3.5 | 3 | 18 | 1 |
| The height property of the HTMLObjectElement interface Returns a string that reflects the height HTML attribute, specifying the displayed height of the resource in CSS pixels. | 1 | 12 | 1 | 3 | 18 | 1 |
| The name property of the HTMLObjectElement interface returns a string that reflects the name HTML attribute, specifying the name of the browsing context. | 1 | 12 | 1 | 3 | 18 | 1 |
| The type property of the HTMLObjectElement interface returns a string that reflects the type HTML attribute, specifying the MIME type of the resource. | 1 | 12 | 1 | 3 | 18 | 1 |
| The width property of the HTMLObjectElement interface returns a string that reflects the width HTML attribute, specifying the displayed width of the resource in CSS pixels. | 1 | 12 | 1 | 3 | 18 | 1 |
Syntax
<object data="document.pdf" type="application/pdf"
width="600" height="400">
<p>Unable to display the PDF. <a href="document.pdf">Download</a></p>
</object> Use cases
Strengthen structure
Use <object> to make the document outline, grouping, or semantics more explicit.
Improve meaning
Apply <object> when clearer HTML structure helps users and tools understand the content.
Cautions
- Test <object> in your target browsers and input environments before depending on it as a primary behavior.
Accessibility
- Prefer semantic structure that improves navigation and interpretation for assistive technologies, not just visual organization.
Related links
Powered by web-features