HTML 5 浏览器兼容性图表 - 旧浏览器中的 HTML 5?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2249261/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:11:07  来源:igfitidea点击:

HTML 5 Browser Compatibility Chart - HTML 5 in Old Browsers?

htmlcompatibilitycustom-data-attributelayout-engine

提问by Lance Pollard

I have just started considering using the HTML 5 api for a Rails/JQuery project, so I can use that great data-attributeto store values.

我刚刚开始考虑将 HTML 5 api 用于 Rails/JQuery 项目,所以我可以使用这个伟大的data-属性来存储值。

I am worried though about browser compatibility issues. I have two questions (basic questions):

我担心浏览器兼容性问题。我有两个问题(基本问题):

  1. In order to use HTML 5, do people need to upgrade their browsers? How does that work?

  2. Is there an up-to-the-day chart of what features each browser layout engine supports, more up-to-date than this Wikipedia article on comparing HTML layout enginesand this When can I use... HTML 5page?

  1. 为了使用 HTML 5,人们是否需要升级他们的浏览器?这是如何运作的?

  2. 是否有关于每个浏览器布局引擎支持哪些功能的最新图表,比这篇关于比较 HTML 布局引擎的维基百科文章和这篇文章更及时,我什么时候可以使用... HTML 5页面?

Is it going to be an issue with people using IE6 for example? Lots of non-computer saavy people I've talked to who want to get an internet presence themselves use, and the people they talk to use, still, IE6!

例如,使用 IE6 的人会出现问题吗?我采访过的许多非计算机专业人士都希望自己使用互联网,而他们与之交谈的人仍然使用 IE6!

If it's not an issue, and you can use HTML 5 on old browsers, how do you? Or what docs should I look at :)? Thanks.

如果这不是问题,并且您可以在旧浏览器上使用 HTML 5,您会怎么做?或者我应该看什么文档:)?谢谢。

Update: I will post some interesting links as I find them below.

更新:我会在下面找到一些有趣的链接。

FindMeByIP: "A simple app which reveals your browsers' support for CSS3 and HTML5 features in an easy to read format using Modernizr." - Browser Support for CSS3 and HTML5

FindMeByIP:“一个简单的应用程序,它使用 Modernizr 以易于阅读的格式显示您的浏览器对 CSS3 和 HTML5 功能的支持。” -浏览器支持 CSS3 和 HTML5

回答by bobince

It is not useful to consider HTML5 as a single entity, that browsers either ‘support' or ‘don't support'. HTML5 is:

将 HTML5 视为单个实体是没有用的,浏览器要么“支持”,要么“不支持”。HTML5 是:

  • an attempt to codify widespread existing practice beyond the limits of what the previous W3 HTML and DOM standards had covered, such as IE and Firefox extensions that the other browsers have copied, and long-standing ‘DOM Level 0' behaviours that everyone took for granted but weren't written into any spec before.

  • a random selection of new extensions not yet in widespread use, which it is hoped browser manufacturers will support. Some have already succeeded, heading into all new browsers already; some have been spun off into their own specifications (which is much more manageable for everyone), some are controversial, and some no-one cares about at all.

  • 试图将广泛的现有实践编纂成超出先前 W3 HTML 和 DOM 标准所涵盖范围的限制,例如其他浏览器复制的 IE 和 Firefox 扩展,以及每个人都认为理所当然的长期“DOM 级别 0”行为但之前没有写入任何规范。

  • 随机选择尚未广泛使用的新扩展,希望浏览器制造商能够支持。有些已经成功,已经进入所有新浏览器;有些已经分拆为他们自己的规范(这对每个人来说都更易于管理),有些是有争议的,有些根本没人关心。

It has been, IMO, an enormous mistake to try to cover these two bases at once. I would have preferred an HTML 3.2-style ‘catch-up' standard plus many separate extension specifications. But there's nothing can be done about it now.

IMO 试图同时覆盖这两个基地是一个巨大的错误。我更喜欢 HTML 3.2-style 'catch-up' 标准加上许多单独的扩展规范。但现在已经无能为力了。

HTML5 is also:

HTML5 也是:

  • Not finished. The specification is massive, complicated, incomplete, and likely to change in details (or maybe more than that) before it becomes a proper standard. No-one can say they ‘support HTML5' yet, because no-one knows yet what ‘HTML5' is actually going to be.
  • 没有完成。规范是庞大的、复杂的、不完整的,并且在成为合适的标准之前可能会在细节上发生变化(或者可能更多)。没有人可以说他们“支持 HTML5”,因为没有人知道“HTML5”实际上会是什么。

In practical terms: there are some parts of HTML5 that have long been in use. There are some parts that you can use safely on modern browsers. There are some parts that you can use on new browsers except for IE. There are many parts you can use with fallback workarounds or ‘graceful degradation'. There are some parts you may never be able to use. For now you will have to learn each separately, because there won't be a browser that supports absolutely everything in HTML5 for many, many years. If ever. Add the extra features you like gradually as you go along and they're supported by a greater share of browsers; there will be no ‘big bang' where everyone updates their browser at once.

实际上:HTML5 的某些部分长期以来一直在使用。您可以在现代浏览器上安全地使用某些部分。有一些部分可以在除 IE 之外的新浏览器上使用。您可以将许多部分与回退解决方法或“优雅降级”一起使用。有些部分您可能永远无法使用。现在,您必须分别学习每一个,因为很多年都不会有一个浏览器完全支持 HTML5 中的所有内容。如果曾经。随着您的进行逐渐添加您喜欢的额外功能,并且更多浏览器支持它们;不会有每个人都同时更新浏览器的“大爆炸”。

As for data-attributes, well, yeah, you can kind of get away with using them, in that most browsers have always allowed any old attributes to go through anyway. This is typical of several HTML5 extensions, the browser doesn't need to explicitly ‘support' it for it to work.

至于data-属性,嗯,是的,你可以避免使用它们,因为大多数浏览器总是允许任何旧的属性通过。这是几个 HTML5 扩展的典型特征,浏览器不需要明确“支持”它才能工作。

But since there are other ways of passing data (classes, comments, script blocks, etc.), I'm not wholly convinced it's worth dropping (universally supported, validatable against a fixed standard) HTML4/XHTML1 pages just for that one feature yet.

但由于还有其他传递数据的方式(类、注释、脚本块等),我并不完全相信值得放弃(普遍支持,可根据固定标准验证)HTML4/XHTML1 页面仅用于该功能.

回答by Seth

You might want to check out diveintohtml5.ep.ioand modernizr.com.

您可能想查看dipintohtml5.ep.iomodernizr.com

Modernizr is a small and simple JavaScript library that helps you take advantage of emerging web technologies (CSS3, HTML 5) while still maintaining a fine level of control over older browsers that may not yet support these new technologies.

Modernizr 是一个小巧而简单的 JavaScript 库,可帮助您利用新兴的 Web 技术(CSS3、HTML 5),同时仍然保持对可能尚不支持这些新技术的旧浏览器的精细控制。



Here's an interactive chart of html feature support: http://a.deveria.com/caniuse/

这是 html 功能支持的交互式图表:http: //a.deveria.com/caniuse/

As you can see, there are a lot of browsers that support quite a few of the H5 features.

如您所见,有很多浏览器支持相当多的 H5 功能。

回答by Seth

If you're using jQuery, concerned about interoperability, and the only reason you're investigating HTML5 is to use the data-*attribute set, then I would consider switching back to a better-supported doctype and using jQuery's $().data()method, which allows you to bind arbitrary pieces of data to DOM nodes, similar to how the data-attribute set does.

如果您正在使用 jQuery,担心互操作性,并且您研究 HTML5 的唯一原因是使用data-*属性集,那么我会考虑切换回支持更好的 doctype 并使用 jQuery 的$().data()方法,它允许您绑定任意将数据块发送到 DOM 节点,类似于data-属性集的作用。

Example:

例子:

<button id="set">Click me!</button>

$('button#set').click(function(){
    if($(this).data('name')){
        alert('Clickin\' again so soon, ' + $(this).data('name') + '?');
    }else{
        $(this).data('name', prompt('Hey good lookin\', what\'s your name?', ''));
    }
});

Try it out!

试试看

回答by Bang

Use Protovis. It uses javascript and HMTL5. No Flash here. More important, Protovis has BSD license. So you can use it in commercial projects. Although D3is the a newer project that authors of Protovis are working on.

使用Protovis。它使用 javascript 和 HMTL5。这里没有 Flash。更重要的是,Protovis 拥有 BSD 许可证。所以你可以在商业项目中使用它。尽管D3是 Protovis 的作者正在从事的一个较新的项目。

回答by Steve

Although this is an old(ish) question, the topic of browser support will always be relevant. There's no right way or wrong way to approach it, but take a look through one of the many browser feature support tables that show you what percentage of users will see a certain feature and then be brutal.

尽管这是一个古老的(ish)问题,但浏览器支持的主题始终是相关的。没有正确的方法或错误的方法来处理它,但请查看众多浏览器功能支持表中的一个,该表向您显示有多少用户会看到某个功能然后变得残酷。

Don't try to please everyone. Don't kill yourself to catch a few percent of the Luddite's who are still using IE7. Next year, substitute that for IE8. Personally, I would be happy to lose 8% in order to spend that time on forward thinking practices rather than catering for those who don't know what an upgrade is.

不要试图取悦所有人。不要为了抓住一小部分仍在使用 IE7 的 Luddite 而自杀。明年,用它代替 IE8。就个人而言,我很乐意损失 8%,以便将时间花在前瞻性思维实践上,而不是迎合那些不知道什么是升级的人。

Maybe your site will cause people to upgrade. These people will come round eventually.

也许您的网站会导致人们升级。这些人最终会回来的。

回答by DmitryK

My answer might not be the one you would like but I would say - don't. Don't use HTML 5 just yet.

我的答案可能不是你想要的,但我会说——不要。暂时不要使用 HTML 5。