Hasn't the <embed> tag been around for a

2020-02-06 02:51发布

问题:

According to W3Schools and Pluralsight's HTML5 course, the <embed> tag is "new" to HTML5. But I've been using it since...forever, and it works in any browser i've tested it against. This page for example, uses the <embed> tag and it works in all browsers.

Why? Was it just a draft that got implemented ahead of time by eager browser makers?

回答1:

The Mozilla docs do agree with W3Schools (for once), but you are right. <embed> has been in use for ages but was standardized properly for HTML5.

HTML 4 officially used <object>. Contrary to several sources which state <embed> was deprecated in HTML 4, I can't find any mention of it in the HTML 3 DTD (or in 3.2), which means it was probably never standardized officially. HTML 2 seems to be even less evolved (as one might expect). There is plenty of documentation about <applet>, but I can't find a single mention about <embed> anywhere official.



回答2:

After a little research and help from you guys, I found that the <embed> tag was originally introduced by Netscape as a means to display images and similar content. Apparently it was never officially implemented into a standard (I checked the HTML 3 and both XHTML standards on W3C). Naturally though Internet Explorer implemented it in order to combat Netscape, and it went from there.

http://1997.webhistory.org/www.lists/www-talk.1995q3/0578.html

http://w3.org/



回答3:

embed wasn't part of W3C standards but was useful enough for browsers to support it. HTML5 takes a pragmatic approach to what is, so it's here.



回答4:

The <embed> tag has in fact been around for a while, but it was deprecated in HTML4 and XHTML1. It was re-introduced in HTML5.

** Corrected. :)



标签: html embed