Wha*_*nID 6 html validation iframe xhtml facebook
我做了什么:我在我的"XHTML 1.0 Transitional"网页上嵌入了Facebook Like Box.Facebook Like Box的源代码由Facebook提供:
<iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fplatform&width=292&colorscheme=light&show_faces=true&stream=false&header=true&height=62"
scrolling="no"
frameborder="0"
style="border:none; overflow:hidden; width:292px; height:62px;"
allowTransparency="true">
</iframe>
Run Code Online (Sandbox Code Playgroud)
W3C验证器说的是:当我在W3C验证器中检查网页时,它会出现以下错误:
第600行,第421栏:没有属性"allowTransparency"
但是,IE需要allowTransparency="true">工作.
预期的解决方案:我应该怎样做才能使其在我的网页上保持Facebook类似框的同时验证为XHTML 1.0 Transitional.
sha*_*mar 10
你可以为它写两个代码.一个用allowTransparencyif语句用于IE而另一个没有它.这样,就可以完成.因此,将此嵌入代码与条件HTML注释一起使用:
<!--[if IE]>
<iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fplatform&width=292&colorscheme=light&show_faces=true&stream=false&header=true&height=62"
scrolling="no"
frameborder="0"
style="border:none; overflow:hidden; width:292px; height:62px;"
allowTransparency="true">
</iframe>
<![endif]-->
<!--[if !IE]>-->
<iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fplatform&width=292&colorscheme=light&show_faces=true&stream=false&header=true&height=62"
scrolling="no"
frameborder="0"
style="border:none; overflow:hidden; width:292px; height:62px;">
</iframe>
<!--<![endif]-->
Run Code Online (Sandbox Code Playgroud)
这将验证XHTML,因为iframe代码已注释掉,您也可以使用allowTransparency.
编辑:在评论中由staticbeast指出关闭iframe.