Modernizr: 一款HTML5浏览器功能支持检测工具

Modernizr is a small JavaScript library that detects the availability of native implementations for next-generation web technologies, i.e. features that stem from the HTML5 and CSS3 specifications. Many of these features are already implemented in at least one major browser (most of them in two or more), and what Modernizr does is, very simply, tell you whether the current browser has this feature natively implemented or not.

Modernizr可以帮你检测当前用户的浏览器是否支持特定的HTML5或CSS3特性。这可以帮助你的HTML5应用节省大量的时间和复杂的编码,提供一处标准的使用方法来检测HTML5特性是否可用。

Modernizr提供一个js脚本文件,你只需要引用这个文件,就可以得到一个全局变量Modernizr,读取Modernizr的属性就可以得知特定的HTML5或CSS3是否支持。

最后,Modernizr是MIT-licensed,所以你可以放心地用在各种类型的项目中。

发表评论