Home » Facebook, Google, HTML

W3C Validation: IFrame Error with XHTML 1.0 Strict Doctype

6 July 2010 12,283 views Popularity: 25% Share/Bookmark

email

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:-

<iframe src="http://www.facebook.com/plugins/likebox.php?profile_id=62473189912&width=300&height=255&connections=10&stream=false&header=false&locale=en_US"  scrolling="no" frameborder="0" style="border: medium none; overflow: hidden; width: 300px; height: 255px;" allowTransparency="true"></iframe>

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.

<object style="border: medium none; overflow: hidden; width: 300px; height: 255px;"  data="http://www.facebook.com/plugins/likebox.php?id=62473189912&amp;width=300&amp;height=255&amp;connections=10&amp;header=false"></object>

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

Hope this helps. Thanks.

Related posts:

  1. jQuery: Grey out background and preview image as popup
  2. Magento: Get width height of image using Varien_Image class
  3. Octopus Paul’s Prediction: Spain will win the FIFA Worldcup 2010
  4. Hardware Interrupt
  5. Magento: Fatal error: Call to a member function getTable() on a non-object
  6. PHP : Read Write Xml with SimpleXML
  7. Website statistic (User Information) in Javascript
  8. Regular Expression check, Validation in PHP
  9. Google says Sorry to me
  10. Cascading StyleSheet (CSS) :: Property Value Pairs
  • http://xhtml.darmowe-blogi.pisz.pl/bez-kategorii/w3c-validation-iframe-error-with-xhtml-1-0-strict-doctype.html W3C Validation: IFrame Error with XHTML 1.0 Strict Doctype …

    [...] W3C Validation: IFrame Error with XHTML 1.0 Strict Doctype … and-your, are-not, doctype, markup, pass-the-w3c, strict-doctype-, supported-with, then-you, [...]

  • http://w3c.darmowe-blogi.pisz.pl/bez-kategorii/w3c-validation-iframe-error-with-xhtml-1-0-strict-doctype.html W3C Validation: IFrame Error with XHTML 1.0 Strict Doctype … | w3c

    [...] URL: W3C Validation: IFrame Error with XHTML 1.0 Strict Doctype … and-your, are-not, doctype, markup, strict, strict-doctype-, supported-with, then-you, xhtml, [...]

  • http://topsy.com/blog.chapagain.com.np/w3c-validation-iframe-error-with-xhtml-1-0-strict-doctype/?utm_source=pingback&utm_campaign=L2 Tweets that mention W3C Validation: IFrame Error with XHTML 1.0 Strict Doctype | Mukesh Chapagain’s Blog — Topsy.com

    [...] This post was mentioned on Twitter by Joonkiri J. Joonkiri J said: W3C Validation: IFrame Error with XHTML 1.0 Strict Doctype http://bit.ly/9IlkIN [...]

  • http://blog.luwenbin.com/htmlxhmtl-if-ie-syntax-comment-problem.html HTML/XHMTL If IE Syntax Comment problem? | SEM

    [...] W3C Validation: IFrame Error with XHTML 1.0 Strict Doctype … [...]

  • http://www.w3cvalidation.net/ W3c Validation

    Thanks for the good information…very good blog site.

  • http://TrafficSpider SEO Traffic Spider

    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 !!!

  • http://www.geeklion.com/2010/09/18/agregar-boton-like-en-tu-sitio-xhtml-1-0-estricto-valido/ Web de León » Agregar botón Like en tu sitio XHTML 1.0 Estricto Válido

    [...] Un poco de investigación por mi cuenta y claro el código válido gracias a ““Mukesh Chapagain’s Blog” Compartir en: Facebook Twitter Google Buzz Digg [...]

  • http://www.hibcdirect.com Bob Davis

    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?

  • http://twitter.com/innerwebs Devin Walker

    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)

  • http://www.luzon-hotels.com/ Frank

    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!

  • http://www.nbmlaw.co.uk Conveyancing

    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.

  • http://www.viaestvita.net انطون بيلوف

    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 :(

  • http://www.spicegirlslondonescorts.com/ London Escorts

    Useful post, thanks for sharing!

  • Brian_barredo013

    i tghink you should use xhtml 1.1 transitional en/