iframe vs object vs embed
<iframe> is the modern standard for embedding web content. <object> and <embed> were designed for plugins like Flash and PDF readers.
For PDF display, use an iframe pointing to the PDF URL or a JavaScript PDF renderer.
<iframe> is the modern standard for embedding web content. <object> and <embed> were designed for plugins like Flash and PDF readers.
For PDF display, use an iframe pointing to the PDF URL or a JavaScript PDF renderer.
<!-- Modern: iframe for HTML content -->
<iframe src="page.html" title="Content"></iframe>
<!-- PDF display with iframe -->
<iframe src="document.pdf" title="PDF document" width="100%" height="600"></iframe>
<!-- Legacy: object (avoid for new projects) -->
<object data="file.pdf" type="application/pdf" width="600" height="400">
<p>PDF viewer not available. <a href="file.pdf">Download PDF</a></p>
</object>
Use PDF.js for reliable cross-browser PDF display instead of relying on the browser's built-in PDF viewer via iframe.