【发布时间】:2011-09-07 05:28:41
【问题描述】:
所以我一直在使用 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 上写了一篇文章。
【问题讨论】:
-
{lang: 'en-GB'}部分在我看来很奇怪。首先,因为相同的脚本标签是从src加载的,所以我认为其中不应该有更多的代码。其次,对象字面量没有分配给任何东西,那么它有什么意义呢? -
@mkilmanas,如果提供了 SRC 属性,浏览器将忽略 SCRIPT 元素的内容,脚本作者仍然可以编写检索 SCRIPT 元素内容的代码(即 @987654325 @上面的部分)并采取行动。这是捆绑脚本可以用作参数或配置等的 JS 对象文字的便捷模式。仅供参考 ...
-
谢谢,虽然很有趣,但还没有意识到
标签: javascript w3c w3c-validation google-plus-one