Embedding XHTML compliant Youtube videos

by David Alfaro 1. October 2008 05:16

What are we facing?

Youtube provides a code for embedding any video in my page, however the such a code is not XHTML 1.0 compliant. What is the generic way of making any Youtube video XHTML 1.0 compliant?

The Solution

The code given by Youtube for any video to be embedded in your page has the following format:

<object width="A" height="B">
   <param name="movie" value="C"></param>
   <embed src="C" type="application/x-shockwave-flash" width="A" height="B"></embed>
</object> 

Where A is the width, B is the height and C is the url's video source.

The XHTML 1.0 friendly version of that is in the following format:

<object type="application/x-shockwave-flash" style="width: Apx; height: Bpx;" data="C"> 
   <param name="movie" value="C" />
</object>

Is the display the same? Take a look (you can also see the source code in your browser)

Displaying with Youtube video code

Displaying with XHTML 1.0 compliant code

Don't you agree that a automated tool to do this would be a great idea? There are many scenarios when this is a "nice to have"

Some external references

Embedding YouTube Videos as Valid XHTML 1.0 of Bernie Zimmermann

YOUTUBE XHTML EMBED of Paimonia

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

standards

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



About Aggiorno KC

Aggiorno RSS Feeds As Web developers, we are always hunting for pieces of wisdom spread all over the Web, by friends, by books, or both. Normally it requires time and effort to search and locate that wisdom and then even more to implement it. Knowledge Capsules provide you with a consolidated place to find all the specific pieces of code and advice you are commonly looking for, all provided by fellow Web developers.

IE8 Compatibility Wizard

Automatically upgrades your website to render correctly in IE8!

Internet Explorer 8 Compatibility Wizard

Get it today!


ArtinSoft Corporation ArtinSoft is Microsoft Certified Partner ISV/Software Solutions and Microsft Visual Studio Partner

With over fifteen years of experience, ArtinSoft has proven to be a key player in software evolution, by allowing customers from all over the world to ensure business continuity and compliance through software migration solutions and developer tools created upon principles of artificial intelligence. At present time, ArtinSoft Corporation remains a private firm in constant growth through a strategic partner network. Read More...