8

When going to YouTube, it gives a embed code such as

<iframe title="YouTube video player"
class="youtube-player" type="text/html" width="640" height="385"
src="http://www.youtube.com/embed/QRvVzaQ6i8A?rel=0">
</iframe>

Note that the

type="text/html"

is not valid html. There's no such attribute for iframe tag.

could anyone explain why google put that? I guess it's for some practical reason, but i couldn't guess what.

PS you can get the embed code by going here http://www.youtube.com/watch?v=QRvVzaQ6i8A

1
  • amazing. Looks like Google fixed it. Now, it no longer include the type=.
    – Xah Lee
    Feb 7, 2011 at 5:43

3 Answers 3

2

It's not a mistake, it's the embed code for the HTML5 Youtube Player.

When it comes to validating HTML, you have to remember that HTML5 allows the content author to use non-standard elements and attributes and the document should still work. Additionally, non-standard markup that becomes popular enough can be documented and become an extension to the HTML5 spec.

1

I guess it is a mistake from Google itself. I suspect a mistake. It was not part of HTML4, and it is not part of HTML5. You can safely ignore it and remove it.

on the type attribute topic: The type on the object element is conforming but obsolete. It has never been really used by browsers to guess the content of the URI served.

1
  • nice link. I tend to concur. I wonder if any googler would say something about it?
    – Xah Lee
    Jan 27, 2011 at 6:48
0

I know this was from a while back, but there's a helpful explanation from a YouTube developer here: http://groups.google.com/group/youtube-api-gdata/browse_thread/thread/f492756804cd481a#msg_29fb6e74326f7a5c.

In short,

  • the ‘type’ and ‘class’ attributes are now gone

however, non-standard frameborder and allowfullscreen attributes have been added:

  • the ‘frameborder="0"’ is for “certain IE versions” (could be replaced by CSS if necessary?)
  • the ‘allowfullscreen' is for “certain Firefox HTML5 playback scenarios”

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.