YouTube Embed Code is not W3C Compliant
I was recently making one of my websites compliant when I became aware that the basic code that YouTube provides users is not compliant with the global XHTML standards - meaning that my site was not fully user-friendly while it was on there.
It turns out that the W3C Validator isn’t keen on <embed> tags appearing anywhere on the page, so I did a bit of research and cam across the following replacement code which works and is completely compliant with the standards:
<object type=”application/x-shockwave-flash” width=”425″ height=”350″ data=”http://www.youtube.com/v/yourcode“><param name=”movie” value=”http://www.youtube.com/v/yourcode” /></object>
The parts where it says your code need to be replaced with the extension that applies to the location of your YouTube video - this is present in the orginal embed code and can be just copied and pasted across.
Excellent information. Thank you very much.
This one really does make me wonder why a company like YouTube don’t provide W3c compliant code. Makes me wonder which is better, w3c compliant or youtube version
Awesome, thanks. Sometimes I wonder who these companies employ, coming up with code like that.
How do you get this to work with wordpress?