Facebook LIKE 按钮和 W3C 验证失败

发布于 2024-10-06 09:58:20 字数 962 浏览 5 评论 0原文

http://developers.facebook.com/docs/reference/plugins/like

要包含来自 facebook 的流行 [Like] 按钮,我必须使用以下代码:

<iframe src="http://www.facebook.com/plugins/like.php?href=www.MyDomain.com&amp;layout=standard&amp;show_faces=false&amp;width=225&amp;action=like&amp;font=lucida+grande&amp;colorscheme=dark&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:250px; height:80px;" allowTransparency="true"></iframe>

由于 allowedTransparency 属性,我的网站不再在 W3C 上验证:

Line 313, Column 342: there is no attribute "allowTransparency"
… overflow:hidden; width:250px; height:80px;" allowTransparency="true"></iframe>

有解决办法吗?我无法使用 XFBML 版本。这非常糟糕..

营销与概念网站舍布鲁克

http://developers.facebook.com/docs/reference/plugins/like

To include the popular a [Like] button from facebook, I must use the following code :

<iframe src="http://www.facebook.com/plugins/like.php?href=www.MyDomain.com&layout=standard&show_faces=false&width=225&action=like&font=lucida+grande&colorscheme=dark&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:250px; height:80px;" allowTransparency="true"></iframe>

My website no longer validate on W3C because of the allowTransparency attribute :

Line 313, Column 342: there is no attribute "allowTransparency"
… overflow:hidden; width:250px; height:80px;" allowTransparency="true"></iframe>

Is there a way around? I cannot use the XFBML version. This is pretty bad..

Marketing et Conception Web Sherbrooke

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

玩物 2024-10-13 09:58:20

您是否尝试过忽略此属性?不应该需要它。标准就更不用说了。

Have you tried omitting this attribute? It should not be required. The standards to not even mention it.

歌枕肩 2024-10-13 09:58:20

好吧,在浏览了数百篇这样的帖子之后,我终于找到了一种快速简单的方法来获取带有“赞”按钮(或任何其他 Facebook 小部件)的有效页面。

实际上只需几行代码,请查看 http: //www.liormark.com/develop/development-articles/facebook-fbml-w3c-validation-solved

Ok, after going over literally hundreds of these posts, I finally found a quick and easy way to get a valid page with a Like button (or any other facebook widget) on it.

Just a fewlines of code really, take a look at http://www.liormark.com/develop/development-articles/facebook-fbml-w3c-validation-solved

夏了南城 2024-10-13 09:58:20

以下代码应该可以解决验证问题:

<script language="javascript" type="text/javascript">
//<![CDATA[
document.write('<fb:like send="true" width="600" show_faces="true"></fb:like>');
//]]>
</script>

The following code should fix the validation issue:

<script language="javascript" type="text/javascript">
//<![CDATA[
document.write('<fb:like send="true" width="600" show_faces="true"></fb:like>');
//]]>
</script>
深海夜未眠 2024-10-13 09:58:20

如果我没记错的话,allowtransparency是微软编造的一个属性。那么,是否对 Internet Explorer 系列使用不同的代码以使其正常工作,并使用不同的代码让其他浏览器进行验证?

虽然这不是您应该担心的事情,但遵循标准是一件好事,但如果您的网站因为类似的事情而无法验证,那也不是世界末日。

If I remember correctly, allowtransparency is an attribute that Microsoft made up. So use a different code with Internet Explorer family to make it work and different code for other browsers to validate?

Although it's not something you should worry about, it's a good thing to follow the standards, but if your site doesn't validate because of things like that, it's not the end of the world.

π浅易 2024-10-13 09:58:20

这是最好的代码:

享受......:)

<div id="fb-root"></div>
    <script type="text/javascript" language="javascript">
    //<![CDATA[
    (function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
    //]]>
    </script>
    <script type="text/javascript" language="javascript">
    // <![CDATA[
    document.write('<fb:like href="URL" send="false" width="450" show_faces="false"></fb:like>');
    // ]]>
    </script>

Here is the best code:

Enjoy....:)

<div id="fb-root"></div>
    <script type="text/javascript" language="javascript">
    //<![CDATA[
    (function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
    //]]>
    </script>
    <script type="text/javascript" language="javascript">
    // <![CDATA[
    document.write('<fb:like href="URL" send="false" width="450" show_faces="false"></fb:like>');
    // ]]>
    </script>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文