Home > Web 2.0, Web Optimization, youtube > YouTube Embed Code is not W3C Compliant

YouTube Embed Code is not W3C Compliant

November 18th, 2008

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.

w3c

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.

Author: Adam Categories: Web 2.0, Web Optimization, youtube Tags:
  1. Benjamin
    March 17th, 2009 at 04:29 | #1

    Excellent information. Thank you very much.

  2. March 24th, 2009 at 18:16 | #2

    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

  3. April 27th, 2009 at 00:07 | #3

    Awesome, thanks. Sometimes I wonder who these companies employ, coming up with code like that.

  4. me
    June 25th, 2009 at 19:12 | #4

    How do you get this to work with wordpress?

  1. No trackbacks yet.