Blank
Blank

Reputation: 7208

How do you embed a SWF object in an XHTML 1.0 Strict webpage?

simple question: I'm looking for a standards compliant way to embed a flash file. I've been using Dreamweaver for this project (not because I like it, but because my co-worker isn't an HTML guru) and it apparantly uses non-standard code to embed flash files. It's probably standard in HTML, but not so much in XHTML which I prefer to use.

What is the standards compliant way to do this? I'd prefer to do it without using that JavaScript library that everyone seems to use, I'm looking for a pure XHTML solution so that my pages degrade gracefully when JavaScript is not enabled.

Thanks, I can post my existing non-compliant code if needed.

Upvotes: 2

Views: 3876

Answers (2)

Tracker1
Tracker1

Reputation: 19344

Here's some info on the Satay methods.

The standards compliant way is to use the <object /> tag, with the appropriate type set. However, the support across different browsers is pretty sketchy. Your best bet is really to use a javascript library such as swfObject to replace/embed the flash into a given div tag.

For the most part, those that disable javascript are likely to not have flash, or to have that disabled as well. Also, the fallback html within the div to be replaced with the flash can be more easily tested as well.

I don't like it any better than you do to be honest, but it really is the easiest way to make sure it works... below is an example if you chose to go that path.


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

Upvotes: 5

Perchik
Perchik

Reputation: 5620

The Satay Method

Upvotes: 1

Related Questions