YouTube and standards — avoiding the illegal “embed” tag

The other day I embedded a YouTube video in one of my blog posts, using the HTML code that YouTube provides on their site.

Trouble is, YouTube’s code uses the “embed” tag, which is not HTML 4 standards-compliant. There’s no such tag as “embed” (even though Firefox and IE know how to display it — but that’s a rant for another day).

I experimented a bit with trying to make it just an object instead, but wasn’t able to get the right parameters so that it would be embedded properly and use the flash player that YouTube provides.

Just now I ran across a post by Bernie Zimmerman that explains the trick. So now Zeigen’s Blog is once again valid HTML code and standards-compliant.

In case Bernie’s web site ever goes down, the trick is to use this HTML code instead of the junky invalid HTML code that YouTube provides:

(where “foo” is replaced with the video’s unique code assigned by YouTube, found at the end of the URL for the video)

Why does this matter? Increasingly we use different types of browsers to read the World Wide Web — Treos, toasters, braille-readers, Opera, you name it. The W3C standards are the rules for how the Web works; if you play by the rules, then you can predict that most people should be able to read your page. YouTube doesn’t play by the rules. The end results of not playing by the rules are ultimately anarchy and chaos, my friend, anarchy and chaos.

I co-wrote a book on this sort of thing — woah, that’s coming up on 10 years ago.

4 Responses to “YouTube and standards — avoiding the illegal “embed” tag”

  1. Bernie Zimmermann Says:

    I’m hoping my website never goes down, but thanks for spreading the word nonetheless! 😉

  2. Stephen Says:

    And thanks to you Bernie for your research and very clear explanation. Happy new year!

    Glad to read on your blog that you survived the Washington Big Blow of 2006 — consider my comment about your web site going away as pure speculation, given the ephemeral nature of the Web (and hopefully your ISP never has a Big Blow of their own). Also, congrats on getting engaged.

  3. Bernie Zimmermann Says:

    Thanks, Stephen.

  4. Gaby Says:

    Gracias,
    Thanks you help me solve that little problem! i’m pretty happy.

Leave a Reply

AVATAR: Sign up for a free avatar with Gravatar.
CLICK FOR COMMENT XHTML TAG HELP