Français

<embed>

Embed external content with no fallback, and why that is rarely a good idea

  • HTML
  • accessibility
  • semantics

<embed> — The embedded container (legacy)

The <embed> element embeds an external resource in the page. Historically used for Flash and browser plugins, it has no common use case today. Prefer <iframe> for documents, <video> for media, <img> for images.

When to use it

Almost never. The only marginal case: embedding a PDF in a browser that does not support <object>. In practice, <iframe> or a direct download link are preferable.

What you gain

Accessibility: nothing. <embed> has no fallback content (unlike <object>). If the resource fails to load, the user sees nothing and receives no information.

Code example

<embed
  src="/documents/report.pdf"
  type="application/pdf"
  width="100%"
  height="600"
>
<!-- No fallback possible — prefer <object> or <iframe> -->

Further reading