View Waheed Akhtar's profile on LinkedIn

Follow Waheed Akhtar on Twitter

Valid XHTML 1.0 Transitional

iPage Affordable Web Hosting only $3.50/mo

Write 100% validated Flash HTML code PDF Print E-mail
User Rating: / 14
Written by Waheed Akhtar   
Thursday, 09 July 2009 06:56

Validating a website's HTML is something that can be done by following the rules of HTML/XHTML scripting. However, as a developer we face a lot of problems in validating common HTML codes that are in practice.

To adjust these exceptions we have to sought out some short cuts or hacks.

In this short article I will guide you to write 100% validated flash embedded HTML code.

W3C standards are used for validating website HTMl/XHTML codes. W3C

In popular HTML editors like Dreamweaver, Front Page or any other you like, there is a standard code for inserting Flash movies or objects.

Normally used flash html code

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=",0,28,0" width="348" height="85">
<param name="movie" value="movie1.swf" />
<param name="quality" value="high" />
<embed src="/movie1.swf" quality="high" pluginspage="" type="application/x-shockwave-flash" width="348" height="85">

This is not W3C valid HTML code. If this code is used in web page and tried to get validated from W3C, It will show you a lot of errors.

If you search the internet  for solution, then you will reach on different topics. However, it will be difficult to found exact W3C valid code that can be used everywhere.

After some research with hit and try methods, I manage to make this code that we used in our client's website also.

100% validated flash html code

<object type="application/x-shockwave-flash" data="Movie1.swf" width="1000" height="250">
<param name="wmode" value="opaque" />
<param name="movie" value="Movie1.swf" />

If this code is used to embed flash movie in webpage. It will pass the W3C validotor.

Basically, if you try to observe the difference between above two codes. Validated code is a lot cleaner and simpler.

There is an additional attribute  data="Movie1.swf".

Now that was for your flash movie code. What if you are using video embed code from YouTube.

Normally used Youtube video code

This video is "Wonderwall" song from Oasis. It's code will be like below

<object width="425" height="344">
<param name="movie" value=""></param>
<param name="allowFullScreen" value="true">
</param><param name="allowscriptaccess" value="always"></param>
<embed src="" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed>


Now guess what?.... Youtube movie code is Not Valid.

Yes, if this code is used directly in web page, code will not be validated from W3C.

Validated Youtube video code

Now here is valid Youtube video code.

<object type="application/x-shockwave-flash" data="" width="560" height="340">
<param name="movie" value=""></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>


This code can be used as it is by just replacing the video "data" and "movie" URLs.

From now on, write Flash code with ease and get validated your website from W3C.

Here are some reference websites, used to write this article.



Last Updated on Wednesday, 19 May 2010 06:48
re: flash code
4 Friday, 10 June 2011 08:44
Thanks m8 it works fine.
3 Friday, 14 May 2010 17:24
pritpal singh
it works.

thanks. a lot .. your code is w3c passed

Valid flash code.
2 Tuesday, 26 January 2010 17:08
Ohhhhh man you are totally rocking. That code you are provided work perfectly.
It worked
1 Wednesday, 15 July 2009 11:34
Mark Raymond
Thanks man, My client was killing me to get the whole website validated including flash. That code worked perfectly.