# `<object>`

> The `<object>` HTML element embeds external resources into documents, such as images, audio, videos or other multimedia content.

## How do I embed a PDF or SVG with the object element?

The element that is used to embed multimedia elements such as images, videos or interactive content like PDFs. It can also serve as a fallback for content that browsers cannot natively support.

- Topic: Media & Embedding
- Type: tag
- Browser support: Chrome 1+, Chrome Android 18+, Edge 12+, Firefox 1+, Firefox Android 4+, Safari 3+, Safari iOS 2+

## Example

Wrong:

```html
<object
  data="report.pdf"
  width="800" height="600"
></object>
```

Right:

```html
<object data="report.pdf" type="application/pdf" width="800" height="600">
  <a href="report.pdf">Download the report (PDF)</a>
</object>
```

Content inside `<object>` shows when the browser cannot render the file, so users can still get it.

## Common mistakes

- Leaving `<object>` empty, so users see a blank box when the browser cannot display the file.

## Key points

- The `<object>` has a `data` URL and a `type` MIME type.
- Fallback content, such as a download link, is placed inside the `<object>`.
- Plain images and icons use `<img>`, not `<object>`.

## Interview questions

### What is the difference between object and img for SVG?

An SVG in `<object>` can run its own scripts and be styled as a document. In `<img>` it is a static image with no scripts.

### What is the difference between object and iframe?

Both embed resources, but `<object>` supports fallback content inside it, while `<iframe>` is meant for HTML pages.

## Related cards

- [`<embed>`](https://wonderium.dev/html/embed.md)
- [`<iframe>`](https://wonderium.dev/html/iframe.md)
- [`<param>`](https://wonderium.dev/html/param.md)
- [`<img>`](https://wonderium.dev/html/img.md)
- [`<svg>`](https://wonderium.dev/html/svg.md)

---

- Level: [HTML](https://wonderium.dev/html.md)
- HTML version: https://wonderium.dev/html/object
- Last updated: 2026-11-25
