Detecting support for specific HTML 5 features via jQuery

后端 未结 2 2010
天涯浪人
天涯浪人 2021-02-08 08:59

I\'m working on some HTML5 demo code, including stuff like

This currently works correctly in Opera 10 as-is, but every other b

2条回答
  •  自闭症患者
    2021-02-08 09:31

    I would take a look at Modernizr. It's an open source, MIT-licensed Javascript library that detects support for many HTML5/CSS3 features and it's REALLY tiny (7kb compressed). To use it, simply:

     
    

    Within the of your document. After that, it has a variety of functions to check for what you need. Example:

    if (Modernizr.canvas) { 
         // do stuff
    }
    

    There's many more ways to check for the specific HTML5/CSS3 feature you'd like. Check out their website to get it and see the docs.

提交回复
热议问题