Check whether the browser supports HTML5/CSS3 artifacts Modernizr and html5css3

Source: Internet
Author: User

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}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.