简体   繁体   English

Twitter 小部件的 W3C 验证

[英]W3C validation for Twitter widget

I use Twitter Widget in my application [asp.net c#].我在我的应用程序 [asp.net c#] 中使用Twitter Widget My code is:我的代码是:

StringBuilder strTwittsViewer = new StringBuilder();
strTwittsViewer.Append("</span><span class='cssClassFollowButton'><a href=\"https://twitter.com/Shree\" class=\"twitter-follow-button\" data-show-count=\"false\">Follow @Shree</a>");
strTwittsViewer.Append("<script type='text/javascript'>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=\"//platform.twitter.com/widgets.js\";fjs.parentNode.insertBefore(js,fjs);}}(document,\"script\",\"twitter-wjs\");</script></span></p>");

but my code unable to pass W3C validation .I got a error但是我的代码无法通过W3C 验证。我得到了一个错误
there is no attribute "data-show-count" …witter-follow-button" data-show-count="false">Follow @shree</a><script typ…
I search and find this solution but unable to understand how to implement this solution with my code.Thanks.我搜索并找到了这个解决方案,但无法理解如何用我的代码实现这个解决方案。谢谢。

Because data attributes are part of the HTML 5 spec .因为数据属性是HTML 5 规范的一部分。 Use <!DOCTYPE html> to specify the HTML 5 doctype使用<!DOCTYPE html>指定 HTML 5 文档类型

Taken from here取自这里

OR要么

Put your link code into document.write so you'll have将您的链接代码放入 document.write 中,这样您就可以

strTwittsViewer.Append(@"<script language=""javascript"" type=""text/javascript"">");
strTwittsViewer.Append(@"//<![CDATA[");
strTwittsViewer.Append(@"document.write('<span class=""cssClassFollowButton""><a href=\""https://twitter.com/Shree\"" class=\""twitter-follow-button\"" data-show-count=\""false\"">Follow @Shree</a>"");");
strTwittsViewer.Append(@"//]]>");
strTwittsViewer.Append(@"</script>");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从W3C XMLschema.xsd(用于xsd验证的模式)生成的xsd.exe C#类未被C#XmlSerializer接受 - The xsd.exe generated C# class from the W3C XMLschema.xsd (the schema for xsd validation) is not accepted by the C# XmlSerializer W3C工具的HTML敏捷包问题 - HTML Agility Pack Problems with W3C tools 在w3c重新命令之后检测/验证XML文件的编码 - Detect/Verify the encoding of an XML file following the w3c recommandation .NET XmlDocument是否真的支持W3C DOM 2级? - Does .NET XmlDocument really support W3C DOM Level 2? W3C,Google Gears和Loki Geolocation基于什么? - W3C, Google Gears and Loki Geolocation based on what? 通过 MassTransit 发布者/消费者传播 W3C 跟踪上下文 - Propagating W3C trace context over MassTransit publisher/consumer 在C3中使用Selenium ChromeDriver在W3C模式下(Selenium :: WebDriver :: Error :: UnknownCommandError)无法调用非W3C标准命令 - Cannot call non W3C standard command while in W3C mode (Selenium::WebDriver::Error::UnknownCommandError) with Selenium ChromeDriver in C# 如何使用Html.TextBoxFor(C#)设置默认值,使其符合W3C标记? - How to set a default value with Html.TextBoxFor (C#) so it is W3C markup compliant? 如何在 .net 核心 3.1 应用程序中访问 W3C TraceContext 标头? - How can I access W3C TraceContext Headers in a .net core 3.1 application? 如何将DateTime .NET数据类型转换为W3C XML DateTime数据类型字符串并返回? - How do I convert DateTime .NET datatype to W3C XML DateTime data type string and back?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM