Home » Facebook, Google, HTML6 July 2010

W3C Validation: IFrame Error with XHTML 1.0 Strict Doctype

IFrames are not supported with XHTML 1.0 Strict Doctype.

When you use IFrame and your doctype is XHTML 1.0 Strict, then you cannot pass the W3C Markup Validation test. You always get errors.

The errors are like:-

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

Solution

Use object tag instead of iframe.

Example

Here is an iframe code for Facebook Like Box:-

Using the above IFrame code in your website gives errors when you validate with W3C.

So, the solution is to use Object tag. You will not get the validation errors by using Object.

It’s the same case with including Google Maps in websites.

Hope this helps. Thanks.

HTML

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • Pingback: W3C Validation: IFrame Error with XHTML 1.0 Strict Doctype …()

  • Pingback: W3C Validation: IFrame Error with XHTML 1.0 Strict Doctype … | w3c()

  • Pingback: Tweets that mention W3C Validation: IFrame Error with XHTML 1.0 Strict Doctype | Mukesh Chapagain's Blog -- Topsy.com()

  • Pingback: HTML/XHMTL If IE Syntax Comment problem? | SEM()

  • Thanks for the good information…very good blog site.

  • I thank you for this useful and complete post, I was looking for post like this. I like your blog.

  • Praveen

    Object is not working on IE

  • Foufa

    Great !
    Thanks a lot for this good information !!!

  • Pingback: Web de León » Agregar botón Like en tu sitio XHTML 1.0 Estricto Válido()

  • This is why I don’t put much stock in W3C validation.

    You put time and effort into building a site that looks good and works properly across 8 major web browsers, then the client wants a facebook like box on there and even though it still works perfectly across all major browsers you get a validation error.

    There are like 23 different “standards” of how to build a proper website according to the W3C. In my opinion, if there are 23 ways to do something then it’s not really a standard.

    Pick any 10 random sites that work and earn over $10 million in revenue and I guarantee at least 9 of them won’t validate according to W3C.

    What does that say?

  • Yeah this doesn’t work in IE I’ve found… which is what I need it to be working in…

  • jayaraj

    i think not supported in Internet Explorer

  • Case510

    Google Chrome will not support this: …

  • Thomas

    Cool, thank you :-)
    Best Regards
    Thomas

  • TrAsHeR

    Thanks you men :) (GOOGLE FTW :D)

  • This works but got really disappointed AGAIN with IE browsers! are not supported by IE, Safari and Firefox browsers while I was testing, works properly on Chrome though.

  • Asdf

    totally worked man, thanks a lot!

  • I couldn’t seem to get it to work. The page loads with no errors but the like panel is not there.

  • Cesar

    thanks!! you help me a lot

  • KingMaximo

    One solution would be to use conditional comments to check for IE and then just use the <iframe> instead of the <object> tag. Code that is invalid in xhtml strict that is in a conditional comment doesn’t seem to be recognized by the W3C Validation. Actually, I just tried this method and it does pass the validation.

    I agree with Bob Davis above, if the standard isn’t recognized by IE, which is the most used browser for casual internet users (how many times have you went to a regular(non-technical) persons’ house that used FireFox to shop on the internet?), then what is the point in a standard. The only people that are really concerned with validation are the internet snobs who still live in their parents’ basement and have never really developed an actual commercial web application. The only thing a client is concerned with is whether the site actually works for their customers, not whether it validates by the W3C standards. Besides what idiot actually came up with the idea of enclosing every image tag in a p tag? A p tag is supposed to be a container for a paragraph, not a block-level container for all inline-elements. As a matter of fact before the object tag will validate it must be enclosed in a p tag or other block-level element. Bunch of nonsense if you ask me.

  • the wrong decision …
    Internet explorer and Chromium not working

  • guest

     For a cross-browser solution you should add : codetype=”text/html” to the object tag.

    Although the way Internet explorer handles “windowed” elements makes it so it’s always on top, it works on a different plane/z-index and you can’t add a wmode param like you would with flash :(

  • Useful post, thanks for sharing!

  • Brian_barredo013

    i tghink you should use xhtml 1.1 transitional en/

  • I really like this article please keep it up.