We help IT Professionals succeed at work.

WC3 compliant html for embedding flash

ncw
ncw asked
on
Medium Priority
1,159 Views
Last Modified: 2011-10-03
How can I modify the following html to make it WC3 compliant:

<embed src="img/something.swf" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

Testing at http://validator.w3.org it says "This page is not Valid HTML 4.01 Transitional!" and it says there's no attributes for src, quality, type, pluginspace, and element "EMBED" undefined.


Comment
Watch Question

b0lsc0ttIT Manager
CERTIFIED EXPERT

Commented:
ncw,

The problem may be the way you are closing the tag.  "/>" is used to close XHTML tags that don't have closing tags.  Embed does have a closing tag and you should use it in HTML or XHTML.

<embed src="img/something.swf" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>

This may fix the validation error.  The rest of that code looks OK to me.

b0lsc0tt
ncw

Author

Commented:
No difference.

<embed src="img/something.swf" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
b0lsc0ttIT Manager
CERTIFIED EXPERT
Commented:
ncw,

The problem may be that the embed tag was never standardized by W3C.  Who knows why that is the case?! Both of the links below are to articles that discuss this and seem to offer a way get flash to work in non-IE browsers and still use valid code that will meet standards.  If it is important to be compliant then you will probably have to use something like the solution in the articles.

http://www.macromedia.com/devnet/dreamweaver/articles/flash_satay.html

http://www.alistapart.com/articles/flashsatay/

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
ncw

Author

Commented:
The full object code was:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="658" height="237" id="something" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="img/something.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="img/something.swf" quality="high" bgcolor="#ffffff" width="658" height="237" name="something" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

which I think matches the 'twice cooked' method in the links.
Commented:
I have a really good solution to this. I've used it on some sites and it validates no problemo (can even validate for XHTML 1.0 strict too!):

http://blog.deconcept.com/flashobject/

Its a script called flashobject. It's got some pretty good capabilities too (such as installing flash for those who do not have it without leaving your site).

Your code would look something like this:

First in your head section you would include the javascript file:
<script type="text/javascript" src="flashobject.js"></script>

Then put this where you want it to display:

<div id="flashcontent">
This text is replaced by the flash movie.
</div>
<script type="text/javascript">
 // <![CDATA[
  var fo = new FlashObject("fo_tester.swf", "fo_tester", "300", "150", 6, "#336699");
  fo.write("flashcontent");
 // ]]>
</script>

Again you can download the JS file and read more about the advantages of using this method here:
http://blog.deconcept.com/flashobject/
Commented:
I use a similar solution to blacksix's solution. I use Unobtrusive Flash Objects (UFO) V3.0 found here:
<a href="http://www.bobbyvandersluis.com/ufo/">http://www.bobbyvandersluis.com/ufo/</a>

From the site:
"UFO is as standards compliant as it can be. Your (X)HTML pages will pass the W3C validation tests, because UFO generates the Flash object's (X)HTML code with JavaScript."

It's free. It also provides you with the opportunity to put valuable content in place of the Flash when a user chooses not to have Flash installed. It has a lot of great features, the developer keeps up with it and maintains a very informative site, and most of all it's really easy to use.

Hope this helps.

--Susan


Commented:
Oops, sorry about that problem with the link in my comment above. I'm new to posting here. My error.

Commented:
Hi uhh-ohhh

To make a link you just type it out, no code:
http://www.domain.com

-Sam
b0lsc0ttIT Manager
CERTIFIED EXPERT

Commented:
ncw,

We have not heard you in a while.  Did any of the comments answer your question?  If so, please accept the appropriate comment with an excellent or good grade.  If you still have a question or need additional information then please let us know so that we can help you resolve the problem.

b
ncw

Author

Commented:
Thank you.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.