<object> Tag in HTML

The <object> tag in HTML is used to embed multimedia files, such as PDFs, videos, audio files, and other web applications into a webpage. It allows for flexible handling of external resources.

Key Points on <object> Tag:

Syntax of <object> Tag:

Syntax Example

<object data="URL" type="media_type" width="width" height="height">
            Alternate content for unsupported browsers
        </object>

Example of <object> Tag in HTML:

This example demonstrates how to embed a PDF file using the <object> tag.

Code Example


        <object data="sample.pdf" type="application/pdf" width="600" height="400">
            Your browser does not support PDFs. Please download the PDF to view it: 
                <a href="sample.pdf">Download PDF</a>.
        
        </object>
                

Output

Your browser does not support PDFs. Please download the PDF to view it: Download PDF.

Using <object> Tag for Embedding a Video:

This example shows how to embed a video file using the <object> tag.

Code Example for Video


        <object data="sample.mp4" type="video/mp4" width="640" height="360">
            Your browser does not support the video tag. 
                <a href="sample.mp4">Download the video</a>.
            
        </object>
                

Output for Video

Your browser does not support the video tag. Download the video.

The <object> tag is highly versatile for embedding various types of multimedia and web applications directly into a webpage. It provides an alternative display option if the resource is unsupported by the browser.