Google & Amazon Generates Invalid HTML

,

More HTML validation Pain.

Here's a amazon ad widget from Amazon Associate site:

<iframe
src="http://rcm.amazon.com/e/cm?t=xyzxyz-20&o=1&p=11&l=ur1&category=textbooks&banner=17P1AE8RQ1T7ZFC62V82&f=ifr"
width="120"
height="600"
scrolling="no"
border="0"
marginwidth="0"
style="border:none;"
frameborder="0">
</iframe>

Of course it is not valid HTML. The ampersand needs to be &amp;. Also, there's no border="0" attribute for “iframe” tag.

Well, Google isn't doing much better. Here's the code given by youtube for embedding a video:

<iframe
title="YouTube video player"
class="youtube-player"
type="text/html"
width="640"
height="390"
src="http://www.youtube.com/embed/nnsSUqgkDwU"
frameborder="0"
allowFullScreen>
</iframe>

“iframe” tag doesn't have the “type” attribute type="text/html", and there's no such thing as “allowFullScreen”.

How bad can it be? So, from these 2 sites alone, handling out bad code, are directly responsible for millions of site being invalid HTML. Of course, all other video sites all hand out invalid HTML. None gives correct HTML as far as i know. 〔☛ How to Embed Video with Valid HTML

In the Google case, am sure they are just trying to solve a practical problem, though, i'm not sure it is absolutely necessary to resort to using invalid attributes. Clearly, the “allowFullScreen” is there to be parsed by JavaScript. If so, then it could easily be a comment tag instead, ⁖ <iframe …><!-- allowFullScreen --></iframe>. And am not too sure that type="text/html" there is really necessary.

I posted the Google's invalid type="text/html" problem to stackoverflow.com, and also posted the question to TubeYou forum at Source www.google.com .

Amazingly, Google fixed it! Now the embed code no longer contains type="text/html". Yay!

blog comments powered by Disqus