如果不支持 HTML 5 的浏览器遇到 HTML 5 网站会发生什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9392082/
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-28 22:42:02  来源:igfitidea点击:

What happens if a browser that doesn't support HTML 5 encounters an HTML 5 website?

html

提问by Ali Foroughi

If you visit a site that uses Flash, and you don't have Flash installed on your browser, a message will be shown to you to install Flash. A similar procedure happens when Silverlight is involved instead of Flash.

如果您访问使用 Flash 的站点,并且您的浏览器上没有安装 Flash,则会向您显示安装 Flash 的消息。当使用 Silverlight 而不是 Flash 时,会发生类似的过程。

What happens if a browser does not support HTML 5? Will I have to install something to get HTML 5 support in that case? Is that even possible?

如果浏览器不支持 HTML 5 会怎样?在这种情况下,我是否必须安装一些东西才能获得 HTML 5 支持?这甚至可能吗?

回答by kinakuta

Browsers will ignore elements it doesn't support and it won't apply css styles to those elements either. You won't get any explicit message that the browser doesn't support HTML5. You can, as the page author, provide your own message if the browser doesn't depending on the circumstance. You can, for example, provide a message that will display to the user inside a video or audio tag.

浏览器将忽略它不支持的元素,也不会将 css 样式应用于这些元素。您不会收到任何有关浏览器不支持 HTML5 的明确消息。如果浏览器不视情况而定,您可以作为页面作者提供您自己的消息。例如,您可以提供将在视频或音频标签内向用户显示的消息。

回答by Thorsten Dittmar

Well what happened earlier, wenn browsers supported HTML3 and you used HTML4? Nothing really, and that's what's going to happen for HTML5.

那么之前发生了什么,wenn浏览器支持HTML3而你使用HTML4?没什么,这就是 HTML5 将会发生的事情。

Flash and Silverlight are handled using browser plugins, so the browser can warn you if the plugin is not installed. HTML5 is not a plugin, so what you could do is to use JavaScript and check for the browser version.

Flash 和 Silverlight 是使用浏览器插件处理的,因此如果未安装插件,浏览器会警告您。HTML5 不是插件,因此您可以做的是使用 JavaScript 并检查浏览器版本。

回答by mbuurman

Users won't get a message if their browser doesn't support certain html5.

如果浏览器不支持某些 html5,用户将不会收到消息。

What you could do is check what html5 or css3 you need, and look at http://caniuse.com/wich browsers are compatible with those functions and then use a script to give older browser users a notification to update to a newer browser.

您可以做的是检查您需要什么 html5 或 css3,并查看http://caniuse.com/哪些浏览器与这些功能兼容,然后使用脚本向较旧的浏览器用户通知更新到较新的浏览器。

回答by rudyjm3

@Ali Foroughi I didn't notice a clear cut work around if you have HTML 5 elements in a website and how to get older browsers namely IE 8 and older to display the new HTML5 elements. Other answers are true that the HTML5 element won't display correctly or at all but what can be done about this.

@Ali Foroughi 如果网站中有 HTML 5 元素以及如何让较旧的浏览器(即 IE 8 及更旧的浏览器)显示新的 HTML5 元素,我没有注意到明确的解决方法。其他答案是正确的,HTML5 元素将无法正确显示或根本无法显示,但是可以对此做些什么。

There a couple things you can do to either "teach" older browsers to handle HTML5 correctly either by CSS, JavaScript, or an HTML5Shiv. These methods are explained here.

您可以通过 CSS、JavaScript 或 HTML5Shiv 来“教”旧浏览器正确处理 HTML5,您可以做一些事情。此处解释这些方法。

Of course these can't be implemented by the end user but by the websites designer/developer.

当然,这些不能由最终用户实现,而是由网站设计者/开发者实现。

Was searching for the answer as to a work around in case someone has an older browser and HTML5 elements are used. I figured if there are work around's for certain CSS styling by using some sort of webkit in the CSS file surely there is for HTML5.

正在寻找解决方法的答案,以防有人使用旧版浏览器并使用 HTML5 元素。我想如果通过在 CSS 文件中使用某种 webkit 来解决某些 CSS 样式,那么肯定有 HTML5。

回答by Darin Dimitrov

but what happen if a browser does not support HTML 5 ?

但是如果浏览器不支持 HTML 5 会发生什么?

Exactly the same as what you described:

和你描述的完全一样:

If you see when a site uses flash technology ,and you have not flash component installed on you browser, a message will be shown to you to install flash(same as silverlight)

如果您看到某个站点使用 Flash 技术,并且您的浏览器上没有安装 Flash 组件,则会向您显示安装 Flash 的消息(与 Silverlight 相同)

This feature detection has absolutely nothing to do with HTML5. It's the implementation of the <object>tag that allows you to specify an url to download the component from if the browser hasn't installed it. It is a browser dependent implementation though.

此功能检测与 HTML5 完全无关。<object>如果浏览器没有安装组件,它是标签的实现,允许您指定一个 url 来下载组件。不过,它是一个依赖于浏览器的实现。