HTML and CSS Reference
In-Depth Information
The basic XHTML code to use the <object> tag to embed a sound loop in a Web page
<object data="soundloop.mp3" height="50" width="100" type="audio/mpeg"
title="Music Sound Loop">
<param name="src" value=soundloop.mp3" />
<param name="controller" value="true" />
<param name="autoplay" value="false" />
A sample page using this <object> tag can be found in the student files at
Chapter11/musicbasic.html. See Figure 11.2 for a screenshot of this page displayed in
the Internet Explorer and Chrome browsers. If you see warning messages when the
<object> tag is used to play media, consult your network administrator or lab support
staff for recommended security settings and/or plug-in installation.
Figure 11.2
The Google Chrome
browser correctly
renders the
multimedia object
Review Figure 11.2. Notice that the Chrome browser correctly renders the <object>
tag and displays a media player for the MP3. However, even though the XHTML is
valid and satisfies W3C recommendations, Internet Explorer does not properly config-
ure the object. Don't worry, there is a solution for this issue—configure another
<object> tag that only Internet Explorer will process. This technique is described by
Elizabeth Castro in an article at
Internet Explorer requires the classid attribute (to indicate the player's ActiveX con-
trol) and its associated codebase attribute in order to properly render an <object> tag
configured for audio or video files. The code to play an audio file with QuickTime
within Internet Explorer is shown below:
<object data="soundloop.mp3" height="50" width="100"
codebase="" >
<param name="src" value="soundloop.mp3" />
<param name="controller" value="true" />
<param name="autoplay" value="false" />
Castro describes a technique in her article to use BOTH <object> tags along with con-
ditional comments (which only Internet Explorer follows) to direct non-IE browsers to
Search WWH ::

Custom Search