How to embed YouTube and Google Video without breaking validation!

by C.K. Sample III on 9/10/2006 · 115 comments

in Blogging

So, here’s the code for either one:

<object type="application/x-shockwave-flash" data="[INSERT VIDEO URL FROM EMBED CODE PROVIDED HERE]" width="400" height="326"><param name="movie" value="[INSERT VIDEO URL FROM EMBED CODE PROVIDED HERE]" /><param name="FlashVars" value="playerMode=embedded" /></object>

Took a while to figure out, but it works. I originally tried the code mentioned in this article, but it kept breaking my site, so I trimmed it all down to the bare essentials. This works for me and my template. Let me know if it does / doesn’t work for yours in the comments. w00t!

UPDATE: Great post from Ryan over at Hapless band of staff and regulars, where he tweaks my code slightly to avoid YouTube upscaling of the video. Check it out.



Advertisements:



{ 27 trackbacks }

tech.no.philia | random musings, but mostly on technology » Blog Archive » The Two Easiest Ways to Embed Videos in WordPress
9/20/2006 at 1:39 pm
Random Insights » Blog Archive » links for 2006-09-23
9/23/2006 at 8:23 am
Embedding Video without XHTML Transitional Validation Errors at Amy Stephen
10/29/2006 at 11:52 pm
Murdoc Online
11/13/2006 at 1:49 pm
Michiblogger
11/13/2006 at 1:53 pm
After the Net » Blog Archive » links for 2006-12-23
12/27/2006 at 6:26 am
eternos.org
2/7/2007 at 3:50 pm
Adding Youtube or Google Video to Blogs at Bee Hive
3/2/2007 at 8:07 pm
tenthofjune
3/9/2007 at 4:47 am
TenthOfMarch.com » Blog Archive » Sucker For Perfection
3/9/2007 at 11:36 am
TenthOfMarch.com » Blog Archive » Tutorial: How to embed flash video in your blog without breaking validation
3/10/2007 at 10:26 am
Sample the Web — Someone wrote up a step by step tutorial…
3/10/2007 at 10:31 am
Блокнот » как красиво встроить YouTube видео в сайт
4/11/2007 at 8:21 am
Tom Cobbaert .eu » Validation
5/10/2007 at 7:15 am
Nida in the parra » Blog Archive » Validando el código de YouTube
5/20/2007 at 2:03 pm
Capitano Uncino » Archivio Blog » Validare il codice di YouTube e simili
9/25/2007 at 8:18 pm
Jake Kasprzak Online › Link to YouTube Video Pages from Embedded YouTube Videos
9/30/2007 at 5:02 pm
XHtml Doğrulamasından Geçebilen Youtube Embed Kodu | Açık kaynak ve kişisel tecrübeler
10/21/2007 at 5:08 am
YouTube Kodları XHTML Doğrulamasından Geçsin - Teknobaz
11/4/2007 at 7:57 pm
Embeding YouTube and Google Video without breaking validation « The Official MartinZ Blog
11/18/2007 at 11:27 am
How to embed Blip.tv videos without breaking validation!
12/2/2007 at 4:28 pm
Make It Up As You Go » Blog Archive » How to Embed YouTube and Google Video with Valid Code
1/11/2008 at 12:02 pm
YouTube & WordPress ist auch eine Zumutung at blog.gauner.org
2/15/2008 at 9:32 am
YouTube Enabled? : a8le.com
2/16/2008 at 12:48 pm
Where does my time go? | lifepassedby.com | Starting again
3/5/2008 at 12:00 am
How to embed YouTube videos directly into your webpage without breaking validation
3/6/2008 at 10:55 pm
Embedding YouTube and Google Videos Without Breaking Validation Revisited | Sample the Web
5/10/2008 at 10:45 pm

{ 88 comments }

1 water damage repair 11/23/2008 at 5:05 pm

I had no idea that you could break validation with a youtube embed. I sure am glad that I ran across this. I guess I need to spend more time in this blog!

Thanks,
Really!

2 Ed 12/19/2008 at 5:51 am

Brilliant, cheers mate! time for a mass embedded vid editing session!

3 trkelebeknet 1/4/2009 at 4:13 am
4 Dan 1/6/2009 at 8:33 pm

Hi, I tried this in Google groups and it strips the code – should this work in Groups, or only Google pages?

Thanks!

5 Vesko 1/8/2009 at 3:48 am

Thanks guys for your hard work. I've tried Ryans' code. It works with IE, Firefox, Opera. Can you please, tell me other browsers about…Finaly I fixed that mess. Here it is at http://www.jewelry-engraver.com

6 Guillaume 1/16/2009 at 1:25 pm

this is the you tube valid embedding code

7 Parrot Videos 1/23/2009 at 2:08 pm

I also though all the coding to embed videos is a little excessive, alot of the tags are repeated and not needed

8 türk pornosu 3/16/2009 at 6:32 am

thank grice nice

9 hdtv antenna 3/29/2009 at 6:11 pm

Everything seems to be working just fine!

10 kualahoo 4/20/2009 at 11:55 pm

I don't see the reason why you have to go through that. The embed code is good enough.
what''s new with this code? am I missing something?!

11 tony 4/27/2009 at 4:57 pm

thanks for that info m really good

12 loyal fan 4/29/2009 at 6:55 am

I go along with everything you say. Which was? Huh?

13 Israel 5/11/2009 at 11:48 am

Can you plaese give a valid xhtml with full screen option?

Thanks helena.

Comments on this entry are closed.

Additional comments powered by BackType

Previous post: Netscape and Cinematical Video Interview with ‘Deliver Us From Evil’ Director Amy Berg

Next post: New mattress rules!

If you liked this post, consider subscribing to my feed in the RSS reader of your choosing, following me on Twitter, or subscribing to my YouTube channel.
My Artwork for sale on Etsy