ReferenceStandard

External resources: object and embed

Object embeds an external resource and can contain fallback content.

Intermediate3 min readLearn · Practice · Review

Published by HTML Code Runner · AI-assisted material · Independent editorial review pending · Editorial policy

On this page

Purpose and content model

Object embeds an external resource and can contain fallback content. Embed is a void element for external content handled by the browser or an available integration. These elements have historical associations with plugins, but obsolete plugin technologies should not be revived for new sites.

For ordinary media, native img, audio, video, or iframe usually gives a clearer and more predictable interface. A PDF may render inside object in one environment and require a separate viewer in another. Plan a direct resource link instead of treating embedded rendering as guaranteed functionality.

Syntax and working example

<object data="/documents/access-guide.pdf" type="application/pdf" width="800" height="600">
<p><a href="/documents/access-guide.pdf">Download the access guide (PDF)</a>.</p>
</object>

Supported attributes and behavior

Object commonly uses data for the URL, type for the media type, width and height for dimensions, name for a browsing-context name where relevant, and form for form association. Embed uses src, type, width, and height, with integration-specific behavior. Many historical object attributes and param-based configurations are obsolete. Use modern supported attributes and do not copy an old browser-plugin recipe into a current page.

Another practical pattern

<p>The guide is also available as <a href="/access-guide/">an HTML page</a>.</p>
<embed src="/documents/timetable.pdf" type="application/pdf" width="800" height="500">

Accessibility and browser notes

An HTML equivalent is often more usable than an embedded document on small screens and with assistive technology. The accessibility of the embedded PDF or other resource matters separately from the surrounding HTML. Provide descriptive link text including the format when it helps set expectations.

Common mistakes

Do not promise that every browser will render the same document viewer or controls. Embed has no ordinary fallback children. An object fallback does not make an inaccessible source document accessible. Avoid technologies that require users to install obsolete plugins.

Verify your implementation

Test a device without an inline PDF viewer and confirm that the user can still obtain the information. Check keyboard movement into and out of the embedded resource. Verify the source document itself for headings, reading order, text alternatives, and usable zoom.

Standard status and sources

Standard; browser availability must be checked independently of specification status.

HTML specification · MDN reference and compatibility data