Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why did YouTube put a type= attribute in iframe for embedded video?

Tags:

html

youtube

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

like image 921
Xah Lee Avatar asked Jan 26 '11 00:01

Xah Lee


2 Answers

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.

like image 55
zzzzBov Avatar answered Oct 14 '22 12:10

zzzzBov


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.

like image 28
karlcow Avatar answered Oct 14 '22 12:10

karlcow