Embedding Flash Files With Valid XHTML (Strict)

I’m sure a lot of people want to know the answer to this problem, it’s just like “How do I do a target="" without breaking my validation?” problem. The answer to the questions are hard to find or hard to implement but lucky for you adding SWF files isn’t hard at all. The biggest problem with the code you get from Dreamweaver is that they add a lot of outdated code to make it “work better with Internet Explorer”. These days that code is completely unnecessary because people who aren’t using the latest browsers don’t really deserve to see your content anyway! Even the Pentium 3 that I have beside me runs IE7 and Opera just dandy.

So here it is, how to embed SWF files while keeping your XHTML valid:

Dreamweaver generated code for SWF

Valid code for XHTML (transitional)

Instructions

  • Remove the embed tag, it isn’t needed and it doesn’t validate.
  • The classid tells Internet Explorer which player to use, fortunately, Flash Player responds to type=”application/x-shockwave-flash” as well, so we can remove this ugly line.
  • The codebase attribute is optional.
  • The only one left: the data-element, it tells Mozilla and Opera where the music is located since they won’t get it out of the param-element.

Related posts:

  1. XHTML Strict & target=”_blank” (and _top) I had made a post a few days ago regarding...
  2. Valid XHTML Vertical Centering Using CSS The simplest method to vertically center your elements while using...
  3. Rotating Script for Text Ads, Banner Ads or Interstitials (or Anything Else!) The following are simple instructions to create a script to...
  4. Reduce the Microsoft Windows 7 WinSxS Folder’s Size You can reduce the Microsoft Windows 7 WinSxS folder’s size...
  5. Generate an OpenSSL CSR for Apache2 and ModSSL Generating an encrypted RSA key You can skip this step...
  6. Opera AdBlock – Simple Ad Blocking – urlfilter.ini, No HOSTS Ad Blocking The best way to block ads with Opera...
  7. managed-keys-zone ./IN: loading from master file managed-keys.bind failed: file not found Oh gosh, someone finally posted the correct information to fix...

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>