HTML Tags

HTML <object> Tag

The <object> tag in HTML is used to embed external resources such as images, videos, PDFs, or even other web pages into a document.
It serves as a versatile container for any kind of media or plugin-based content.

Syntax

<object data="URL" type="MIME-type" width="value" height="value">
  Alternative content displayed if the object cannot be loaded.
</object>

Attributes

AttributeDescription
dataSpecifies the URL of the resource to be embedded.
typeDefines the MIME type of the embedded content (e.g., application/pdf).
widthSets the width of the embedded object.
heightSets the height of the embedded object.
formAssociates the object with a form element.
nameAssigns a name to the embedded object.
usemapRefers to an image map defined elsewhere in the document.
typemustmatchIf present, requires the type attribute and the resource’s actual MIME type to match exactly.

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HTML object Tag Example</title>
</head>
<body>
  <h2>Embedding a PDF File Using &lt;object&gt; Tag</h2>
  <object data="/samples/sample.pdf"
          type="application/pdf"
          width="600"
          height="400">
    Your browser does not support embedded PDF files. 
    <a href="/samples/sample.pdf">Download PDF</a> instead.
  </object>
</body>
</html>

Output

Browser Output

There is a visible embedded PDF viewer (if the browser supports it).
If not supported, the fallback text and link are displayed.
Use our Try It Editor to see the live output.

Browser Support

Chrome
Chrome
Firefox
Firefox
Edge
Edge
Safari
Safari
Opera
Opera
IE
IE9+
✅Yes✅Yes✅Yes✅Yes✅Yes✅Yes

The <object> tag is supported by all modern browsers, including Internet Explorer 9 and above.
However, the actual rendering depends on the content type and whether the browser supports that MIME type (e.g., PDF or image).

Notes

  • The <object> tag can embed images, PDFs, multimedia, and even web pages.
  • If the browser doesn’t support the specified media type, the fallback content between <object> and </object> will be shown.
  • Use the type attribute to specify the correct MIME type — this helps browsers determine how to handle the content.
  • For embedding multimedia like audio and video, prefer <audio> and <video> tags for better compatibility and control.
  • <object> can be nested to provide multiple fallback sources.
  • Security note: avoid embedding untrusted external content directly to prevent potential script injection.

Conclusion

The <object> tag is a powerful and flexible HTML element for embedding various types of external media and documents.
While modern browsers support it well, it’s best used for specific cases such as PDFs or plugin-based files, not for audio/video playback where dedicated tags exist.

Sign In Form

User your email and password to singn in

Don’t have an account, signup here : 

HTML5 & CSS3

Tools and Tutorials

Want a Website

Want a website for your business ?

Please fill out the details below, so we can reach out to you.

Registration Form

Signup to track your record and much more.

We have sent you an email with a registration link. Please click the link to verify your email address, or enter the 6-digit OTP provided in the email.

Didn't receive the OTP. Regenerate OTP Resend