Embedding YouTube Videos

We recently discovered that the code YouTube provides to allow us to embed videos into our websites does not validate. Why should you care?  If code is not valid (is not properly written), although it may very function okay on your computer, it can cause lots of problems for other software such as:

  • printers – ever experienced your printer spitting out page after page of gobbly goop?
  • web browsers – page may not display, ormay display inconsistenly on different computers/browsers
  • search engines – search engines can’t index information they can’t read. If your content is not indexed you lose all hope of coming up for that term if some types it in a search box.

Kudos to Bernie Zimmermann who suggests that instead of using their suggested format…

<object width=”425″ height=”350″><param name=”movie” value=”http://www.youtube.com/v/7_6B6vwE83U”></param><embed src=”http://www.youtube.com/v/7_6B6vwE83U” type=”application/x-shockwave-flash” width=”425″ height=”350″></embed></object>

Use the following format:

<object type=”application/x-shockwave-flash” style=”width:425px; height:350px;” data=”http://www.youtube.com/v/7_6B6vwE83U”><param name=”movie” value=”http://www.youtube.com/v/7_6B6vwE83U” /></object>

which still functions correctly, and validates.

Leave a Reply