Check whether the browser supports HTML5/CSS3 artifacts Modernizr and html5css3
What is Modernizr?
Modernizr is a JavaScript library used to detect the support of browser functions. Currently, Modernizr can detect 18 CSS3 functions and more than 40 HTML5 functions by checking the browser's processing of a series of tests. It is more reliable than the traditional method of detecting browser names (Browser SNIFFING. The execution time of a set of tests is only several microseconds. In addition, the Modernizr website only detects the elements you are interested in through custom scripts to achieve efficiency optimization.
Traditional browsers will not be completely replaced at present, making it difficult for you to embed the latest CSS3 or HTML5 functions into your website. Modernizr came into being to solve this problem. As an Open Source JavaScript library, Modernizr checks the browser's support for CSS3 or HTML5 functions. Modernizr does not try to add functions not supported by browsers of earlier versions, but allows you to modify the page design by creating optional style configurations. It can also simulate features not supported by browsers of earlier versions by loading custom scripts.
Modernizr is easy to use, but not omnipotent. The successful use of Modernizr depends largely on your CSS and JavaScript skills. This guide shows you how to set an optional style for browsers that do not support multi-bar or projection. In addition, you can also learn how to enable the browser of the old version to verify the form that uses the latest HTML5 requirement (required) attribute, and how to selectively load script files based on the browser features.
Download Modernizr
Visit the Moderniz website at http://www.modernizr.com/
Usage:
If the browser supports local storage, the Code is as follows:
if (Modernizr.localstorage) {// window.localStorage is available!} else {// no native support for local storage :(// maybe try Gears or another third-party solution}