关于的区别

<object>与<embed>之间到底有什么关系和区别?

以下是摘自 http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-June/020472.html 的回答

On Tue, Jun 16, 2009 at 1:37 AM, Stephen Paul Weber wrote:

> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > Two questions. > > 1) What is the difference between <embed> and <object> in the spec?  The > wording is quite different, but seem to say basically the same thing: "plugin > data". 

<object> is not necessarily about plugins (see below).



> 2) Under <object> it says: "The object element can represent an external > resource, which, depending on the type of the resource, will either be > treated as an image, as a nested browsing context, or as an external > resource to be processed by a plugin." > > Why specify that a User Agent will use a plugin to process the data if it is > not an image or nested browsing context?  Why not leave that decision up to > the User Agent? 

Basically,

if it is an image, <object> is equivalent to <img>

if it is a nested browsing context, <object> is equivalent to <iframe>

otherwise, <object> is equivalent to <embed>



(except that <object> has a richer fallback mechanism than <img>,

<embed> doesn't have one at all)



Though, now that HTML5 introduces <video> and <audio>, I wonder if

<object> couldn't be equivalent to those when type of the resource is

some video or sound...



-- 

Thomas Broyer

你可能感兴趣的:(object)