views:

895

answers:

2

Hi there, 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.

+1  A: 

The Satay Method

Perchik
+3  A: 

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>
Tracker1
Hmm... Seems that only Netscape requires the <embed> tag, so I really don't see the issue with this. If anyone is really still using the old Netscape browser, they have no business viewing a large variety of pages today. ^_^ But I'll test this to be sure.
Nicholas Flynt
IE is particulary quirky... more information is in the link.
Tracker1