What is the function of the <embed> and <Object> tags in HTML5?

Asked

Viewed 624 times

4

In the explanation on the website https://www.w3schools.com/html/html_object.asp explains how to use these tags but both do the same things, so why use one or the other they have something different? or one is better than the other in terms of processing ? which would be the best option to use ?

  • The question is a good one, but I’m afraid I won’t get good answers. I’ve searched the internet and there are only bad answers. It would take someone with authority to answer this, it can’t just be opinion.

2 answers

2

According to MDN

The HTML element <object> represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be manipulated by a plug-in.

The HTML Element <embed> represents an integration point for an external application or interactive content (in other words, a plug-in).

The most noticeable difference is that <embed> is a Empty element, that is, it cannot contain any element within it. Already the <object> allows, can be a fallback, which is something that will be shown if there is no support for that external resource, for example, an SVG:

<object data="your.svg" type="image/svg+xml">
  <img src="yourfallback.jpg" />
</object>

The elements <object> also allows passing parameters to the external resource:

<object data="movie.swf" type="application/x-shockwave-flash">
  <param name="foo" value="bar">
</object>

The attributes allowed in<embed> sane:

  • width

  • height

  • src

  • type

The attributes allowed in<object> sane:

  • width

  • height

  • date

  • type

  • form

  • name

  • usemap

There are others but they are obsolete in HTML5

-1

Embed, if I’m not mistaken, that’s when you’ll put a resolution of another site or server, usually puts it on a site to play the video or content stream from another site.

Object, if I’m not mistaken too, that’s when you’ll place a code responsible for creating an object as a table, a source in flash (this is the one I’m less sure of).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.