You are here: joeclark.orgAccessibilityCaptioningBest practices in online captioning

Standards-compliant Web pages with captioning

Using embed and object with valid code

The typical method to include multimedia in a Web page is the embed element (details). Nearly every known graphical browser supports it, but embed has never been part of the HTML or XHTML specs.

If you use embed on a conventional HTML or XHTML page, you can never achieve valid code as required by Priority 2 of the Web Content Accessibility Guidelines:

The preferred method to add multimedia, according to the specs, is the object element. With its many possible forms of alternate content, it’s a useful replacement in accessibility terms – or would be if Internet Explorer on Windows handled it reliably, which it does not.

Your choice as an author, then, is to use a noncompliant method (embed) that works everywhere or a compliant method (object) that breaks down in the browser used by 90% of people on the Web. A Solomonic choice at best – and one that has been partially solved by standards-compliant developers.

First test the best

In solving this problem, developers should at least test a pure-object approach with their target audience. On a corporate intranet where everyone uses the same browser, object could be made to work under some circumstances, for example. In this way, developers can make every effort to follow the letter and spirit of the standard.

The object element can be used in some cases. One method uses nested object elements and CSS hacks to include multimedia in a page. It works in many browsers, according to its author’s testing.

If, however, testing proves there are incompatibilities with a pure-standards approach, some other alternatives are available.

Flash Satay

Drew McLellan developed a method to use nested object elements to add a Flash file to a Web page. This Flash Satay technique is something of a hack, but it’s valid code and is in use on real-world sites (e.g., University of Florida, WDDG, Torbytes).

Improvement on Flash Satay

  1. Writing at A List Apart in July 2006, Elizabeth Castro explains how she uses a pure-object approach that makes Windows Media and QuickTime files play adequately while retaining valid code.

  2. Object Embedding” by Jessey et. al.

Hacking the DTD

Many authors will wish to adhere strictly to the W3C’s published document types. Some standards-compliant Web developers insist on such adherence, but it is not absolutely necessary. The Web Content Accessibility Guidelines merely require adherence to spec. But HTML is based on SGML and can be extended; XHTML is also XML, which is by definition eXtensible. Thus, authors may write their own document-type definitions (DTDs). This isn’t cheating; it’s using the extensible nature of the specifications to suit a problem not anticipated in the existing W3C DTDs.

In both HTML and XHTML, authors simply need to write a DTD and include it in a page through a DOCTYPE (document type). The declaration specifies the embed element and its parameters, making it legal for that page if used according to that spec.

Examples, tutorials, and resources

  1. Roberto Scano suggests a method of using Flash or other external objects without embed? (View source there.) “It uses IE comments and validates.”
  2. Ian Hickson put together his own method of embedding Flash (and, by extension, anything else) without embed.
  3. The Literary Moose created a tutorial especially for this activity: Modifying XHTML 1.0 with old-style embedded objects.
  4. The Web Design Group’s article HTML Validation: Using a Custom DTD is a standard reference, with, sadly, no example of custom-crafted embed declarations.
  5. J.J. Solari’s Custom DTDs, with useful example
  6. Joe Crawford’s Ancient DTD Hacking, with sample DTD adding embed to HTML (and text-format version of the DTD).
  7. An anonymous page lists HTML 4.01 Transitional and XHTML 1.0 Transitional DTDs using embed, but neither the HTML (plain/fussy) nor the XHTML (plain/fussy) DTDs validates.
  8. The SVG Wiki includes an article on Embeding SVG in HTML, with a link to an example DTD.


  1. The official W3C validator (stricter fussy-parsing version) can validate documents with custom DTDs under many circumstances
  2. The unofficial Web Design Group validator understands some custom DTDs

JavaScript markup insertion

You can use JavaScript functions to document.write() HTML or XHTML code into a document, as in Jeremy Keith’s example. This may be the least-desirable workaround in that it makes potentially-invalid code invisible to validators, which can’t complain about what they can’t detect.

Version history

Link to Elizabeth Castro article added.
Added Jessey link in response to Web Standards Project posting.