ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
Last Update: 5 January 1998

7.8 EMBED and NOEMBED Elements

Netscape 2.0 introduced an EMBED element (an empty element) to specifies an arbitrary data object to be embedded within the document. This object can, for example, be an audio file, a VRML (Virtual Reality Markup Language)data file, or even a spreadsheet. The display of this object is accomplished by a browser plugin, that must be downloaded by the user and added to the browser. If a browser is not equipeed with the required plugin, the browser will usually warn the user that the embedded object cannot be displayed, and will display an empty box in its place.

The NOEMBED element, placed after an EMBED, can contain HTML markup to be displayed by a browser that does not understand EMBED. Unfortunately, browsers that understand EMBED will ignore subsequent NOEMBED content, even if they is unable to display the embedded object.

EMBED can take a number of attributes. The mandatory SRC attribute specifies the URL for the data to be embedded, while the optional TYPE attribute can specify the mime type for the data. ALIGN defines the alignment of hte applet on the page (with the usual values, as per the IMG element), while HIDDEN means that the embedded object should be entirely hidden from view (useful, for example, for playing audio files in the background). HEIGHT and WIDTH specify the height and width of the embed region, and are mandatory. The optional HSPACE and VSPACE attributes can be used to add spacer (in pixels) around the object.

EMBED can also take arbitrary attributes specific to the embedded plugin. Of course, to use these you have to know what they are!

Here is an example of EMBED:

  <EMBED SRC="/path/file.cmx WIDTH="100" HEIGHT="200" >
  <NOEMBED>
  <P>Sorry, but you do not have a Corel CMX plugin for
  displaying Corel CMX image files. Here is an alternate
  version, as a regular GIF
  <IMG SRC="/path/file.gif" HEIGHT="200" WIDTH="100"
       ALT="stupid example image">
  </NOEMBED>

EMBED and NOEMBED are supported by Netscape 2+ and Internet Explorer 3+. In the future they are destined to be replaced by the new OBJECT element -- unfortunately. OBJECT is not well-supported by current browsers, and should be avoided for now.


ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
© 1994-1998 by Ian Graham
Last Update: 5 January 1998