vs.

OBJECT vs. EMBED – why not always use embed?

Bottom line: OBJECT is Good, EMBED is Old. Beside’s IE’s PARAM tags, any content between OBJECT tags will get rendered if the browser doesn’t support OBJECT’s referred plugin, and apparently, the content gets http requested regardless if it gets rendered or not.

object is the current standard tag to embed something on a page. embed was included by Netscape (along img) before anything like object were on the w3c mind.

This is how you include a PDF with object:

<object data="https://stackoverflow.com/questions/1244788/data/test.pdf" type="application/pdf" width="300" height="200">
  alt : <a href="https://stackoverflow.com/questions/1244788/data/test.pdf">test.pdf</a>
</object>

If you really need the inline PDF to show in almost every browser, as older browsers understand embed but not object, you’ll need to do this:

<object data="https://stackoverflow.com/questions/1244788/abc.pdf" type="application/pdf">
    <embed src="https://stackoverflow.com/questions/1244788/abc.pdf" type="application/pdf" />
</object>

This version does not validate.

Leave a Comment