<embed> tag in HTML not supported

12,194

Solution 1

The non-standard embed tag is not supported in XHTML in favour of the standards based object element. See http://www.bernzilla.com/item.php?id=681 for more information on this, but in a nutshell:

<object type="application/x-shockwave-flash" data="c.swf?path=movie.swf" width="400" height="300">
    <param name="movie" value="c.swf?path=movie.swf" />
    <img src="noflash.gif" width="200" height="100" alt="No Flash" />
</object>

Keep in mind though that using object doesn't always work correctly in older browsers, so do a bit of testing using both formats first. A List Apart has a brilliant article on this called "Flash Satay: Embedding Flash While Supporting Standards" which shows you the cross browser way of implementing it as shown in the example above.

Solution 2

It might be worth looking into SWFObject, a lot of projects use it so that they can validate and also easily embed videos dynamically in a cross-browser way. If you don't need dynamic embedding or version detection, the Flash satay method Dereleased points to is another good way.

Solution 3

HTML5 (and thus XHTML5) now allows <embed> element. Switch to HTML5 (<!DOCTYPE html>) and it will validate.

Solution 4

Use an <object> element.

See: http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.3

embed is not standard but is the most widely supported.

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

You can of course use other param elements for things like window mode (wmode) and such. However note that in IE the movie will need to be clicked to be activated, which is why many people use JS to dynamically replace elements with embed for all browsers so no clicking needs to be done in IE.

Solution 5

This article describes in pretty deep detail how to embed flash files while maintaining standards:

A List Apart: Flash Satay: Embedding Flash While Supporting Standards

Share:
12,194
Carlos Muñoz
Author by

Carlos Muñoz

Ex IBMer. Now in the web development world!

Updated on June 07, 2022

Comments

  • Carlos Muñoz
    Carlos Muñoz almost 2 years

    I get the following warning in a ASP.NET project using the <embed> tag to put a .swf:

    Warning: Validation (XHTML 1.0 Transitional): Element 'embed' is not supported.

    What is the "supported" way to do it instead???

  • Nathan Kleyn
    Nathan Kleyn over 14 years
    @meder Good catch, my typing is atrocious today. =]
  • Matthew Scharley
    Matthew Scharley almost 13 years
    <embed> wasn't deprecated in any version of HTML, because it was never in any spec (except HTML5 now). See stackoverflow.com/questions/5972555/… for more.