<object> element attributes

You will have noticed from the example page that browser support for objects is variable. In some cases MIME types are not supported at all. In others the way in which the object is represented varies from browser to browser. This poses quite a challenge to the web developer, who's main concern is to ensure that content is displayed in a consistent and appropriate format.

The basic <object> syntax assumes that the browser can elicit support (either from its internal object handlers (e.g. GIF display) or from external programs (e.g. PDF files). However, this might not work for a range of reasons.

  • There are situations when the user may not have the support files or plug-ins necessary to display the content.
  • It is also possible that different clients may have different plug-ins, each of which handle display in a different way, perhaps using different <param> elements.

The <object> element provides additional attributes including a mechanism for identifying a specific plug-in and allowing it to be downloaded. These attributes are identified below with a brief description of their purpose.

'title' attribute

This provides the equivalent of an alternative text facility for embedded content. In itself it may not be sufficient for accessibility, especially if the content is a 30 minute video presentation with an important soundtrack. Also, the title attribute isn't interpreted by all assistive technologies.

'standby' attribute

This value provides a text message which will be displayed while the object is being loaded. This is particularly useful where the embedded content does not stream and the user has to wait for the whole file to be downloaded before it displays.

'classid', 'codebase' and 'codetype' attributes

These three attributes form the core which allows content to be played using a specific plug-in. Unfortunately, support is mainly used for deploying ActiveX on a Microsoft Windows platform. This means that any browsers not supporting ActiveX technology will fail and use the alternative content. We will look at this problem later in the tutorial. The following shows the abridged code for playing Windows Media content (view the source for the full code):

<object classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
        codebase="http://activex.micro ... sion=5,1,52,701"
        standby="Loading  Media Player components..." 
        type="application/x-oleobject" width="320" height="240">
  <param name="ShowDisplay" value="0" />
  <param name="ShowControls" value="0" />
  <param name="AutoStart" value="1" />
  <param name="FileName" 
         value="resources/IceScraping.wmv" />
  <p>Support for ActiveX WMV playback not available</p>
</object> 

The effect of this code is:

Support for ActiveX WMV playback not available

Be aware that support for this by itself is limited to platforms and browsers which support ActiveX technology. This means that Mozilla Firefox will not display the video, whereas Internet Explorer and Opera will. Clients on non-Microsoft operating systems will have a problem with this technique. The next session looks at a first step to solving this issue.

See the demonstration page for using ActiveX plug-ins to display content in <object> elements.

Valid XHTML 1.0! | Valid CSS! | WCAG Approved AA
Page design by: John P Scott - Hosting with: Netcetera