HTML5-Compliant YouTube Embedding
Posted on by AJ Ianozi
Today I was updating my fathers site, Home Tips With Jim, to be HTML5-compliant. It was pretty much just a matter of removing the center tag and target="_blank" from the links
– or so I thought.
I’m putting this out there for anyone that may run into the problem in the future; while trying to use YouTube’s new iframe embed system to embed my father’s playlist into the page, I ran into two problems spit out by the W3 Validator:
Attribute allowfullscreen not allowed on element iframe at this point. And: The frameborder attribute on the iframe element is obsolete. Use CSS instead.
After some quick research, I found the solution; apparently frameborder is depreciated, and allowfullscreen is not fully implemented. The solution, was to remove those two elements, and replace the frameborder one with CSS. So, if anyone else runs into this problem, go into the <iframe>
tag, and change this part:
frameborder="0" allowfullscreen
To this:
style="border: none"
To this:
style="border: none"
You can now view the source to the HTWJ site, and see how it’s been fixed.