W3C Validation: IFrame Error with XHTML 1.0 Strict Doctype

When you use iframe with XHTML strict Doctype 1.0 then, you can not pass the w3c validation check. You always get an error because iframe is not supported XHTML 1.0 strict Doctype.

Errors you will get:

there is no attribute “src”
there is no attribute “scrolling”
there is no attribute “frameborder”
there is no attribute “height”
there is no attribute “width”
there is no attribute “allowtransparency”
there is no attribute “title”
element “iframe” undefined

To resolve this error you can change your iframe tag with the object tag

Here is a iframe code for Facebook Like Box:

<iframe src=”http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2Fhttpwwwratanjyotcom%2F33055917560&amp;width=292&amp;colorscheme=light&amp;show_faces=true&amp;border_color&amp;stream=true&amp;header=true&amp;height=427″ scrolling=”no” frameborder=”0″ style=”border:none; overflow:hidden; width:292px; height:427px;” allowTransparency=”true”></iframe>

Use the given blow code instead of above code:

<object data=”http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2F%23%21%2Fpages%2Fhttpwwwratanjyotcom%2F33055917560&amp;width=680&amp;colorscheme=light&amp;show_faces=true&amp;border_color&amp;stream=true&amp;header=true&amp;height=427″ style=”border: medium none; overflow:scroll; width: 690px; height: 355px;”></object>

By this you can pass w3c validation check.

You can also you this code in Google Map.

Similarly change the iframe into object and use data at the place of src.

 Click here to see a demo

Share This Post

Post Comment