所以我一直在玩 Google 的 +1 按钮,试图在我的网站上使用它,但它不符合 W3C。
代码如下:
<!-- Place this tag in your head or just before your close body tag -->
<script type="text/javascript" src="http://apis.google.com/js/plusone.js">
{lang: 'en-GB'}
</script>
<!-- Place this tag where you want the +1 button to render -->
<g:plusone size="medium" href="http://www.example.org"></g:plusone>
有谁知道为什么会发生这种情况以及如何使其合规?谢谢
编辑:为了让它通过验证,我在我的 website 上写了一篇文章.
最佳答案
Does anyone know why this happens?
因为 Google 将其设计为使用标签汤而不是 HTML
How to make this compliant?
documentation具有在 HTML 5 规范草案下有效的替代标记:
<div class="g-plusone" data-size="standard" data-count="true"></div>
如果你想让它与 HTML 4.x 或 XHTML 1.x 一起工作,那么你可能就不走运了(虽然你可以使用 JS 添加不兼容的标记,但这只是一种黑客攻击从验证中隐藏它,根本不符合有效标记的精神)
关于javascript - Google +1 按钮不符合 W3C 标准,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6217434/