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:-
<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&width=300&height=255&connections=10&header=false"></object>
It’s the same case with including Google Maps in websites.
Hope this helps. Thanks.
Related posts:
- jQuery: Grey out background and preview image as popup
- Magento: Get width height of image using Varien_Image class
- Octopus Paul’s Prediction: Spain will win the FIFA Worldcup 2010
- Hardware Interrupt
- Magento: Fatal error: Call to a member function getTable() on a non-object
- PHP : Read Write Xml with SimpleXML
- Website statistic (User Information) in Javascript
- Regular Expression check, Validation in PHP
- Google says Sorry to me
- Cascading StyleSheet (CSS) :: Property Value Pairs
