如何在浏览器中检测HTML 5兼容性 [英] How to detect HTML 5 compatibility in browser

查看:183
本文介绍了如何在浏览器中检测HTML 5兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为HTML 5语法检测浏览器兼容性的最佳方法是什么?如果浏览器不兼容,提示用户?

What is the best way to detect browser compatibility for HTML 5 syntax? And prompt the user if the browser is not compatible?

我了解教程如何测试HTML5的浏览器兼容性。但我很好奇知道这是唯一的方式吗?我需要检查每个元素吗?

I understand the tutorial which shows how to test browser compatibility for HTML5. But I am curious to know if that is the only way? Do I need to inspect each and every element?

推荐答案

看看 Modernizr


利用HTML5和CSS3的新功能,意味着
牺牲对旧版浏览器的体验的控制。 Modernizr 2
是您制作最好的网站和应用程序
的起点,无论您的访问者
使用什么浏览器或设备都能正常工作。

Taking advantage of the new capabilities of HTML5 and CSS3 can mean sacrificing control over the experience in older browsers. Modernizr 2 is your starting point for making the best websites and applications that work exactly right no matter what browser or device your visitors use.

由于新的Media Query测试和内置的YepNope.js
微库为Modernizr.load(),您现在可以将功能
检测与媒体查询和条件资源加载相结合。
给你的优势和灵活性,以优化每一个
的情况。

Thanks to the new Media Query tests and built-in YepNope.js micro-library as Modernizr.load(), you can now combine feature detection with media queries and conditional resource loading. That gives you the power and flexibility to optimize for every circumstance.

它有很多内置在测试浏览器功能的方法,并提供一个有用的方法提供后备代码,当您要使用的功能不支持。

It has a lot of built in methods to test for browser features and provides a useful way of providing fallback code for when features you want to use are not supported.

更多信息:http://www.modernizr.com/

这篇关于如何在浏览器中检测HTML 5兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆